>SELECT Batch#, Trans#, ; > SUM(IIF(Category = "RegTime", GrandChild.Quantity, 0)) AS RegTime_amt, ; > SUM(IIF(Category = "Absence", GrandChild.Quantity, 0)) AS Absence_amt, ; > ... ; > FROM < be sure to include the parent tables with the proper joins > ; > INTO CURSOR MyCursor ; > GROUP BY Batch#, Trans# >>