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.
| Author |
Topic |
|
vijayanto
Starting Member
16 Posts |
Posted - 2009-06-02 : 08:20:57
|
| hi friends i got trouble in sql queryso in the table i have date and quantity fieldsso, i want to display the sum of quantity depending on the month of the date for example : the month april means, in another field i want only the month of april quantitiescan anyone reply meregardsvijay |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-06-02 : 08:26:53
|
| select month(Date), sum(quantities) from urtable group by month(date) |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-06-02 : 08:47:56
|
| or select dateadd(month,datediff(month,0,Date),0), sum(quantities) from urtable group by dateadd(month,datediff(month,0,Date),0)MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|