• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 264
  • Last Modified:

sql query help


hello there,

i have a table which contains product names and qty.they are repeated many times inthe table.i want to collect all the product and sum their qty.
for e.g.

p1   200
p2  300
p3   200
p1  100
p1  200
p2  50

now i want three rows like this
p1 XXX
p2 XXX
p3 XXX

where XXX is the sum of all its qty
0
zolf
Asked:
zolf
2 Solutions
 
Chandan_GowdaCommented:
try the attachment
query.txt
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
a simple group by should do
select product_id, sum(amount) from yourtable group by product_id

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now