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)
 Fill date gaps

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-11-29 : 08:24:31
Kien writes "Hi SQLTeamer,

I have a table call tblsales with 2 fields (date,product_id, amount)
date product_id amount
1/11/2006 1 200
1/11/2006 2 300
2/11/2006 3 500
5/11/2006 4 700

How can I write a select statement for the out put

date totalamount
1/11/2006 500
2/11/2006 500
3/11/2006 0
4/11/2006 0
5/11/2006 700

I mean I would like to get all from min(date) to max(date) with include the date without sale.

Thank you!"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2006-11-29 : 08:24:54
http://www.sqlteam.com/item.asp?ItemID=3332
Go to Top of Page
   

- Advertisement -