title: Inserting the SQL query result in Excel
body: <p>I am using the below SQL query which is returing multiple rows and coloumns in result, when i am trying to pass those in excel i am not able to do it</p>
  
  <p>Code:</p>
  
  <pre><code>Set com = QCConnection.Command
  com.CommandText = "select RN_TESTER_NAME as 'Tester, sum(case when RN_STATUS='Passed' then cnt else 0 end), sum(case when RN_STATUS='Failed' then cnt else 0 end)from (select count(*) cnt, RN_STATUS,RN_TESTER_NAME from  RUN Where RN_Execution_Date = '5/17/2017'group by RN_STATUS,RN_TESTER_NAME) as RUN group by RN_TESTER_NAME order by RN_TESTER_NAME"
  Set RecSet = com.Execute
  For Col = 0 To RecSet.ColCount - 1
     Sheet4.Cells(Col + 1, 7) = RecSet.FieldValue(Col)
  Debug.Print Sheet4.Cells(Col + 1, 7)
  Next
  </code></pre>
  
  <p>I am getting the result as the below
  User1 <br>
  2 <br>
  3 <br></p>
  
  <p>I want the result in this manner (please note this is the way qc is showing me the result<br>
  User1   2    3  (2 and 3 are the values)<Br>
  User2   1    0 <br>
  User3   6    3 <br> </p>
  
  <p>Also tried to use, but no help</p>
  
  <pre><code>For Col = 0 To RecSet.ColCount - 1
     Sheet4.Cells(Col + 1, 7) = RecSet.FieldValue(Col)
     Sheet4.Cells(Col + 1, 7) = RecSet.FieldValue(Col+1)
  Next
  </code></pre>
  
  <p><em>EDIT : Please note i am not able to get the User2 and User3 data in that query, but when tested in QC it is showing me the data and there is the data present. Thanks</em></p>