Hi,

I was wondering if it was possible to query a data and then transpose it.

This is what I have:

Code:
SELECT     gasQualityDefine.gqName AS GAP, sampledGasAnalysis.specificGravity AS 'SG',
sampledGasAnalysis.CO2 AS 'C02',sampledGasAnalysis.N2 AS 'N2',sampledGasAnalysis.C1 AS 'C1',sampledGasAnalysis.C2 AS 'C2',sampledGasAnalysis.C3 AS 'C3',sampledGasAnalysis.IC4 AS 'IC4',
sampledGasAnalysis.NC4 AS 'NC4',sampledGasAnalysis.IC5 AS 'IC5',sampledGasAnalysis.NC5 AS 'NC5',sampledGasAnalysis.C6plus AS 'C6+', sampledGasAnalysis.contractTime

FROM         sampledGasAnalysis INNER JOIN
                      gasQualityDefine ON sampledGasAnalysis.gqId = gasQualityDefine.gqId

WHERE     gasQualityDefine.gqname in ('001', '002', '003', '004', '005', '006', '007' )

AND (sampledGasAnalysis.contractTime BETWEEN CONVERT(DATETIME, '2012-09-01 09:00:00', 102) AND CONVERT(DATETIME, '2012-10-01 08:59:00',102)) 

AND (sampledGasAnalysis.auditVersion = 0) AND (sampledGasAnalysis.dataQuality = 10 OR
                      sampledGasAnalysis.dataQuality = 11)

order by gqname
And this is the result:

GAP SG CO2
001 # #
002 # #
003 # #
004 # #
005 # #
006 # #
007 # #


But I would like to have the GAP on top like so:

GAP 001 002 003 004 005 006 007
SG
CO2
etc..

Is it possible to do it like that?

Thanks for the help