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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Sum Question

Author  Topic 

o0wutant0o
Starting Member

1 Post

Posted - 2008-09-15 : 12:55:26
I am looking to sum the inv for each day grouped by the dept. I am looking to get for 20080827 get the sum 4343 for inv, and on 20080828 the sum 4339. Any help with a query would be much appreciated.

num inv date dept
3 1144 20080827 GM
3 1140 20080828 GM
4 3199 20080827 GM

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-09-15 : 12:59:02
SELECT dept, date, SUM(inv) AS inv
FROM YourTable
GROUP BY dept, date

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-09-15 : 22:33:19
quote:
Originally posted by o0wutant0o

I am looking to sum the inv for each day grouped by the dept. I am looking to get for 20080827 get the sum 4343 for inv, and on 20080828 the sum 4339. Any help with a query would be much appreciated.

num inv date dept
3 1144 20080827 GM
3 1140 20080828 GM
4 3199 20080827 GM



How do you get 4339 for 20080828 ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-16 : 00:00:32
quote:
Originally posted by khtan

quote:
Originally posted by o0wutant0o

I am looking to sum the inv for each day grouped by the dept. I am looking to get for 20080827 get the sum 4343 for inv, and on 20080828 the sum 4339. Any help with a query would be much appreciated.

num inv date dept
3 1144 20080827 GM
3 1140 20080828 GM
4 3199 20080827 GM



How do you get 4339 for 20080828 ?


KH
[spoiler]Time is always against us[/spoiler]




may be op has some other unposted data for 20080828
Go to Top of Page
   

- Advertisement -