June 4, 2015 at 1:15 pm
I have a cte:
With cte as
(
Select distinct Incident_ID,
ACTUAL_SEVERITY ,
Policy
From
table)
There are 3 ACTUAL_SEVERITY value: 1-High, 2-Medium and 3-Low
I need the final result be like:
Policy High Medium/Low
How do I write the script with out using temp table or cursor? Can anyone help? Thank you very much.
June 4, 2015 at 1:20 pm
Sounds like you just need to use PIVOT...can't be 100% sure though without some sample data/output.
June 4, 2015 at 1:24 pm
yb751 (6/4/2015)
Sounds like you just need to use PIVOT...can't be 100% sure though without some sample data/output.
Thanks, never used pivot before, can you help?
June 4, 2015 at 1:48 pm
Please post DDL (CREATE TABLE statement) for the table(s) involved, some sample data for the table(s) involved (INSER INTO statements), and the expected results based on the sample data you provide.
June 4, 2015 at 2:03 pm
halifaxdal (6/4/2015)
yb751 (6/4/2015)
Sounds like you just need to use PIVOT...can't be 100% sure though without some sample data/output.Thanks, never used pivot before, can you help?
If it is indeed what you need I'll be more than happy to provide an example. 😉 However, as I hinted to and Lynn has mentioned we need some sample data and what you expect to see. Providing column names is only half of what we need. I know often folks are reluctant to post confidential data which is perfectly understandable. In those case just make up some values.
Cheers,
June 4, 2015 at 2:08 pm
Or you could read the following article and learn how to do it yourself, either with pivot or cross tabs.
June 5, 2015 at 8:20 am
Thanks to all replies, I will come back once I am out of some other issues
Viewing 7 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply