Dear All,
Im writing a query to get results of my sales and stock from two different tables in sql and i want it to display as horizotal on store basis.
please see the below reference.i Achieved up to here by using CASE in SQL
DATE
| SALE QTY
| ITEM ID
| 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 121 |
|---|
| 15-10-2017 | 3 | ABCD | 1 | 1 | 1 | | | | | | | | | |
| 16-10-2017 | 5 | BCDEF | 1 | | | 1 | | 1 | 1 | 1 | | | | |
| 17-10-2017 | 4 | XCGDT | 1 | | 1 | | | | | | 1 | 1 | | |
bUT i need another column also to display as horizontally under store numbers stock column. how i can achieve this in SQL.
I need like below format. FIRST AND STOCK AS ROWS I NEED. STORE WISE STOCK.
| DATE | SALE QTY | ITEM ID | 111
| 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120
| 121 |
|---|
| | STOCK | 5 | 5 | 10 | 6 | 8 | 2 | 4 | 6 | 9 | 8 | 2 |
| 15-10-2017 | 3 | ABCD | 1 | 1 | 1 | | | | | | | | |
| 16-10-2017 | 5 | BCDEF | 1 | | | 1 | | 1 | 1 | 1 | | | |
| 17-10-2017 | 4 | XCGDT | 1 | | 1 | | | | | 1 | 1 | | |
ANYONE HELP ME PLEASE.