Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with GroupBy Query 1

Status
Not open for further replies.

dvannoy

MIS
May 4, 2001
2,765
US
I need some help with a groupBy query.

I am calculating the number of days it takes to bill a document. the docs have line items on it. not all line items will be ready for billing at the same time. Is there a way in the criteria of the query to grab the last date that line item was released?? see there could be line 1 entered 3 times all with different release dates. in order for me to calculate truly I need to show only the last date.

so if line 1 had three entries:

20 released on 09/01
10 released on 09/04
15 released on 09/20

i would want to group that line item and only show 09/20. that way my calculation would be correct..

thanks in advance



DVannoy
A+,Network+,CNA
dvannoy@onyxes.com
 
Could you use the MAX function along with the GROUP BY:

SELECT MAX(MyTable.MyDate), SUM(MyTable.Released)
FROM MyTable
GROUP BY MyTable.MyDate

I am not sure and did not try this, but it might point you in the right direction. Terry M. Hoey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top