Hi,
I have one SQL Table with 3 columns as below
Column1: ProductionDate - DateTime - Not NULL
Column2: Quantity - Int - Not NULL
Column3: ProductName -string - not null
Now There are 5 Records in Table
1-1-2007, 5,Pen
1-3-2007, 7,Stabler
1-3-2007,4,pen
1-5-2007,9,Pencil
1-5-2007,2,stabler
Output of Result should be as below
1-1-2007 5,pen
1-1-2007 0,stabler
1-1-2007 0,pencil
1-2-2007 5,pen
1-2-2007 0,stabler
1-2-2007 0,pencil
1-3-2007 4,pen
1-3-2007 7,stabler
1-3-2007 0,pencil
1-4-2007 4,pen
1-4-2007 7,stabler
1-4-2007 0,pencil
1-5-2007 4,pen
1-5-2007 2,stabler
1-5-2007 9,pencil
Means Query should return all the dates of Month with Quantity and productName and if there is no entry in Table then the previous days quantity for Quantity.
How to Do it? Please suggest with Query
I have one SQL Table with 3 columns as below
Column1: ProductionDate - DateTime - Not NULL
Column2: Quantity - Int - Not NULL
Column3: ProductName -string - not null
Now There are 5 Records in Table
1-1-2007, 5,Pen
1-3-2007, 7,Stabler
1-3-2007,4,pen
1-5-2007,9,Pencil
1-5-2007,2,stabler
Output of Result should be as below
1-1-2007 5,pen
1-1-2007 0,stabler
1-1-2007 0,pencil
1-2-2007 5,pen
1-2-2007 0,stabler
1-2-2007 0,pencil
1-3-2007 4,pen
1-3-2007 7,stabler
1-3-2007 0,pencil
1-4-2007 4,pen
1-4-2007 7,stabler
1-4-2007 0,pencil
1-5-2007 4,pen
1-5-2007 2,stabler
1-5-2007 9,pencil
Means Query should return all the dates of Month with Quantity and productName and if there is no entry in Table then the previous days quantity for Quantity.
How to Do it? Please suggest with Query
Comment