Thanks Set for starting me on the right track. Please see my finalized query
below which gets me to the expected result.
Good to see that you got the result you wanted, Bhavbhuti! I do have two
comments regarding your final result:
1) Why do you use ORDER BY within the CTEs? In the outer
Dataset:
1Haemogram Report 1Routine
Haemogram
1Haemogram Report 5Diff. Count
(Mature Cells)
1Haemogram Report 10 Special
Investigations
2Haemogram Report
The screen shot was stripped please bear with me I will paste the original
query and the original output now:
WITH cteTestGroups AS (SELECT MIN(A.iSrNo) AS iGroupSrNo
, B.cTitle
, MIN(C.iSrNo) AS iSubGroupSrNo
, C.cSubGroup
FROM sReqSlipTestGroup A