wwalkerbout (9/16/2012)
Hi,Messing around withn SQL queries on a Sunday, so I have another question (posted my fist one this morning). This time, its about the way the data is set out in the returned Table. I am working with SQL Server 2008 R2 and using Microsoft SQL Management Studio. So I'm looking at the way the table is displayed when I execute my query.
The query in question is pulling Lookup Table names and values from the Project Server 2010 ProjectServer_Published database. The query is listed below:
USE ProjectServer_Published
SELECT l.LT_NAME AS Table_Name,
MSP_LOOKUP_TABLE_VALUES_PUBLISHED_VIEW.LT_VALUE_TEXT AS 'Lookup Table Value'
FROM dbo.MSP_LOOKUP_TABLES_PUBLISHED_VIEW l INNER JOIN
dbo.MSP_LOOKUP_TABLE_VALUES_PUBLISHED_VIEW
ON l.LT_UID = MSP_LOOKUP_TABLE_VALUES_PUBLISHED_VIEW.LT_UID
WHERE l.LT_NAME = 'Project Status' OR
l.LT_NAME = 'Project Phase'
ORDER BY LT_NAME, 'Lookup Table Value'
The result of this query is:
[Code="plain"]
Table_NameLookup Table Value
Project PhaseBuild
Project PhaseClosure
Project PhaseImplementation
Project PhaseInitiate
Project PhasePlan
Project PhaseTransition
Project StatusCancelled
Project StatusComplete
Project StatusIn Progress
Project StatusLogged
Project StatusOn Hold
[/code]
Is there a way to change the query so that I can have each 'Table_Name' displayed as the column header and the values displayed in the column below each Table_Name?
Any suggestions on how I would go about doing this would be appreciated.
Cheers,
Wayne
Not sure what you want for an output on this, Wayne. Could you post your result above as you'd actualy like to see it?
--Jeff Moden
Change is inevitable... Change for the better is not.