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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subtotal problem

Status
Not open for further replies.

Slonoma

Programmer
Jul 10, 2003
41
US
Hey all,
Any help will be greatly appreciated. I have a table like this:

To | From | Date | Quantity
2 1 5-27 100
2 1 5-27 300
2 3 5-27 400
2 3 5-27 100
2 3 5-28 200

I would like to change the query have subtotals to show the quantity total for each by to, from, and date..so it would look similar to this:

To | From | Date | Quantity
2 1 5-27 400
2 3 5-27 500
2 3 5-28 200

Anyone have any ideas how this can be done?

Thanks,

Slo-No


 
Something like this ?[tt]
SELECT A.To, A.From, A.Date, SUM(A.Quantity) AS Total
FROM the TableName A
GROUP BY A.To, A.From, A.Date[/tt]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top