2

I want to do pivots on dominant(table_name) with N number of rows, here is the structure of my table

billingid   sku_id   qty
   1          101     1
   1          102     2
   1          106     5 
   2          107     3
   2          109     2
   2          108     1 
   2          201     1
   3          205     5 
   4          209     2
   .           .      .
   .           .      . 
   .           .      .
   n           n      n

and here is the format which is desired

billingid  101  102  106  107  109  108  201  205 ... n
   1
   2                 **SUM OF QTY*** 
   3                
   4                 **SUM OF QTY*** 
   .
   .
   .                 **SUM OF QTY*** 
   n

Any help would be much appreciated, Thanks in advance.

Deepesh
  • 820
  • 1
  • 14
  • 32
  • Then ask a specifiq question and not in general how you can do dynamic pivoting. Because I would simply repeat the 2nd part of the code in the accepted answer. – Shadow Feb 29 '16 at 10:43
  • Seriously consider handling issues of data display in the presentation layer if that's available (e.g. a bit of PHP) – Strawberry Feb 29 '16 at 10:51

0 Answers0