Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to add Record.

Author  Topic 

Zevher
Starting Member

3 Posts

Posted - 2009-11-22 : 23:25:22
i have 4 field orderID,SO,StockID,Qty
Like this

OrderID SO StockID Qty
x-0 z-2 tes 5
x-0 z-2 yos 4
x-0 z-2 pro 4
x-0 s-2 no 4

I want to sum all that qty field
and get the answer is 17
how is the sql code? please help me

Zevher
Starting Member

3 Posts

Posted - 2009-11-23 : 01:06:48
Worst Forum Ever.
Go to Top of Page

vikky
Yak Posting Veteran

54 Posts

Posted - 2009-11-23 : 01:28:09
HI,

select order_id,sum(qty) from ur table.

Thanks,
vikky.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-11-23 : 04:05:49
quote:
Originally posted by Zevher

Worst Forum Ever.


Why? you want to get answers in a minute

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-11-23 : 04:07:55
quote:
Originally posted by vikky

HI,

select order_id,sum(qty) from ur table.

Thanks,
vikky.



1 select order_id,sum(qty) from ur table group by order_id
2 select sum(qty) from ur table.



Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -