[dba-SQLServer] Crosstabs - Pivots

Haslett, Andrew andrew.haslett at ilc.gov.au
Thu Jul 15 02:22:39 CDT 2004


Greetings all.  The infamous crosstab question!

I've managed to get the data I require in the following format

JOB     LEDGER   BALANCE
0862	04PRA	    68444.85
0862	04PRB	    44783.0
0915	04PRA	    5092.0
0915	04PRB	    46000.0
1045	04PRA	    5400.0
1045	04PRB	    5400.0

How can I transform it to this:
JOB      04PRA        04PRB
0862     68444.85   44783.0
0915     5092.0       46000.0
1045     54000.0     5400.0


A few samples on the net show you how to do it, but they all require a
numeric value to pivot on so you can use an aggregate function.

I don't want to aggregate anything - just transform (pivot) them...

Thanks in advance

Andrew

IMPORTANT - PLEASE READ ******************** 
This email and any files transmitted with it are confidential and may 
contain information protected by law from disclosure. 
If you have received this message in error, please notify the sender 
immediately and delete this email from your system. 
No warranty is given that this email or files, if attached to this 
email, are free from computer viruses or other defects. They 
are provided on the basis the user assumes all responsibility for 
loss, damage or consequence resulting directly or indirectly from 
their use, whether caused by the negligence of the sender or not.



More information about the dba-SQLServer mailing list