May 27, 2008 at 9:25 am
Hi,
I am trying to put row values into columns which works for the first row, but not the others, i think i need to change my sql and use unions. The sql is below, how can I get the measure values back for each case and not just the first, all other values are null?
Please help.
SELECT TOP 100
(SELECT CASE
WHEN GDA.Measure_Name = 'BizOps Bill D CDD' THEN GDA.Measure_value
END) 'BizOps Bill D CDD',
(SELECT CASE
WHEN GDA.Measure_Name = 'BizOps Bill D CGID' THEN GDA.Measure_value
END) 'BizOps Bill D CGID' ,
VT.YEAR
FROM forecast.V_GDM_DATA_ALL_EMEA GDA , forecast.V_TIME VT
WHERE VT.LINK_TO_TIME = GDA.LINK_TO_TIME
AND GDA.Measure_value IS NOT NULL
AND GDA.Measure_Name IN ('BizOps Bill D CGID', 'BizOps Bill D CDD')
AND VT.YEAR = '2008'
May 27, 2008 at 9:39 am
Paul - You're not giving us a lot to go on. I think you're looking a pivoting or cross-tabulating data, but without some specifics (like what does the source data look like, and what would the expected result look like), it's hard to be helpful.
Just in case - you might care to pop "crosstab SQL Server" into google and get some ideas if that looks kind of like what you're after.
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
May 27, 2008 at 9:40 am
lol, sorry about that, i should have invested a bit more time on the question, will add to it.
thanks for your help.
p.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply