WAG Select empcode, (select sum(gross) from table1 sumtable where sumtable.empcode = table1.empcode top 52 order by cycle desc) as grosssum from table1 group by empcode
Tracy > -----Original Message----- > From: Sytze de Boer > Sent: Wednesday, January 17, 2007 1:39 PM > > Hi folk > I have a table where amongst other fields, I have empcode > C(10), gross N(10,2), cycle N(5) empcode is the employee > code, gross is total pay, cycle is the pay number > > I want to: > select empcode, sum(gross) from mytable order by empcode > group by empcode into table newtable BUT I ONLY WANT THE LAST > 52 CYCLES (Some may have 300 cycles) Some may only have (say) > 30 cycles > > Is this feasible ? > > Regards > Sytze _______________________________________________ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.