Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 28687

SQL Pivot or Something Else

$
0
0

Hi,

 I am having a Table Definition for Agent Sampling (as follows and with sample data) ,

   Date          Client ID              Product ID          Qty              Batch        Agent Id

   1/1             001                     120                   6                  002             1

   1/1             001                     121                   3                  001             1

   1/1             002                     127                   5                  022             1

   1/1             002                     123                   10                302             1

   1/1             002                     122                   2                  102             1

   1/1             003                     134                   3                  332             1

 Now I want query output as following for Particular Agent and Date

 Client                  [Prod/Batch/Qty]-1      [Prod/Batch/Qty]-2      [Prod/Batch/Qty]-3      [Prod/Batch/Qty]-4

 001                    120/002/6                    121/001/3

 002                    127/022/5                    123/302/10                   122/102/2

 003                     134/332/3

 Please help me for this, I couldn't understand how can i get this output in sql query. I tried with Pivot technique but pivot doesn't work without aggregate functions.


Viewing all articles
Browse latest Browse all 28687

Trending Articles