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

Querying out Duplicates and Suming Total Values 1

Status
Not open for further replies.

elevins

Technical User
Jan 24, 2005
18
I have been trying to make a query in SQL, that would take out duplicates and then sum all the values. I am looking for some direction on how to approach this.

Lets say I have three fields of data:

Item Lot Quantity
111 SSS 100
111 SSS 220
123 ABC 100
123 ABC 200
123 XXX 1000
111 XXX 20

And I would like it to return something like this


111 SSS 320
111 XXX 20
123 ABC 300
123 XXX 1000

I somebody could give me direction, or maybe let me know what the best way to do this would be.

thanks

eric

 
Code:
Select Item, Lot, Sum(Quantity)
From   Table
Group By Item, Lot
Order By Item, Lot

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Thanks gmmastros. That worked great!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top