I have a table with product id's and names, and another table with the stock of these products on certain dates. Such as Item1
had 6
stock on 1-1-2014
and 8
stock on 2-1-2014
.
I'm trying to show these in a stored procedure so that it looks like a calendar, showing all the dates in a month and the stock available in the cells. What is the best way to show this?
For example:
Name | 1-1-2014 | 2-1-2014 | 3-1-2014 | 4-1-2014
Item1 | 6 | 8 | | 6
Item2 | | 2 | 1 |
Original tables - Names
ID | Name
1 | Item1
2 | Item2
Original tables - Stockdates
ID | NameID | Stock | Date
1 | 1 | 8 | 2-1-2014
2 | 2 | 2 | 4-1-2014
See Question&Answers more detail:os