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)
 SQL Query Needed

Author  Topic 

kamalkishore_in
Yak Posting Veteran

76 Posts

Posted - 2001-07-29 : 21:48:27
Hi,
I have a talbe with the follwoings

Table
Id,Qty,Dt
1,2,2001/01/01
1,5,2001/01/01
3,1,2001/01/02
4,2,2001/01/03
3,6,2001/01/02
4,7,2001/01/10

I need the sum of qty based on Dt field From and To. Group by Id.

ex. Date from 2001/01/01 to 2001/01/02
Result is :
Id,Qty
1,5
3,7

...And one more Same query but the different Date ex.
ex. Date from 2001/01/01 to 2001/01/10
Result is :
Id,Qty
4,9

Till here the query looks simple... But I wants to combile these two results like that. And I need the query for the following result.
Id,Qty1,Qty2
1,5,0
3,7,0
4,0,9

I hope you got my question... any further clarification welcome..





   

- Advertisement -