January 24, 2014 at 12:21 am
Hi ,
I am trying to use same column twice with different filer conditions ,any suggestions on this will be helpfull for me.
SELECT
Id
,CASE WHEN cffit.IdentifierId = 'IIN' THEN cffit.IdentifierValue END AS 'IIN'
,CASE WHEN cffit.IdentifierId = 'IMS' THEN cffit.IdentifierValue END AS 'IMS'
FROM
dbo.clo_Identifier_TB cffit
WHERE Id=24
This is how I am trying ,but it is giving me null values also.
January 24, 2014 at 12:37 am
You didn't specify an ELSE clause, so if cffit.IdentifierId is neither IIN or IMS, you will get a NULL value.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
January 24, 2014 at 2:23 am
I want these values as seprate :
Id , IIN ,IMS
So ,If i am using else here it is giving me blank values ,I want to use only the column with values only values :
IDIINIMS
24NULLNULL
2400088NULL
24NULL111
24NULLNULL
I want only
IDIINIMS
24 00088 111
January 24, 2014 at 2:29 am
Maybe it's a good idea to provide sample data when you initially ask the question.
Check the first link in my signature on how to ask questions.
SELECT
Id
,IIN = MAX(IIN)
,IMS= MAX(IMS)
FROM dbo.clo_Identifier_TB cffit
GROUP BY Id
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
January 24, 2014 at 2:49 am
Hi,
Thanks a lot for your help , Its working with using Max and group By .
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy