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
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
I am getting the result as the below
User1
2
3
I want the result in this manner (please note this is the way qc is showing me the result
User1 2 3 (2 and 3 are the values)
User2 1 0
User3 6 3
Also tried to use, but no help
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
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


