Perhaps you could handle it in your original query by having a table of 
the months and years to join against...something like...

tblPayPeriods
payYear
payMonth

tblPayData
GrossPay
payYear
payMonth
payClass

tblPayClass
payClass
sortorder

query...

SELECT SUM(b.GrossPay) AS Amount, a.payYear, a.payMonth, c.payClass
FROM tblPayPeriods a CROSS JOIN tblPayClass c LEFT JOIN tblPayData b on 
a.payYear = b.payYear and a.payMonth = b.payMonth AND c.payClass = 
b.payClass
GROUP BY a.payYear, a.payMonth, c.payClass, c.sortorder
ORDER BY c.sortorder, a.payYear, a.payMonth

That way, you know you have at least one record for each pay 
period/class combination and they are in the correct order for output.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7 
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs 
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267791
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to