April 25, 2011 at 9:03 am
select id,
idnum,
max(dischargedate) as dischargedate,
case when (race_2 is null) or (race_other is null)
then racecode= finalrace
when racecode = 'W' and race_2 = 'H'
then Finalrace = 'H'
end as 'Finalrace'
from #All
group by dischargedate,id,
idnum,race_2,race_other,racecode
giving me error message
Incorrect syntax near '='.
could you please help?
Thanks.
April 25, 2011 at 9:13 am
hbanerje (4/25/2011)
select id,idnum,
max(dischargedate) as dischargedate,
case when (race_2 is null) or (race_other is null)
then racecode= finalrace
when racecode = 'W' and race_2 = 'H'
then Finalrace = 'H'
end as 'Finalrace'
from #All
group by dischargedate,id,
idnum,race_2,race_other,racecode
giving me error message
Incorrect syntax near '='.
could you please help?
Thanks.
The structure of your case statement is in correct. You only include the value in the statement without an equal sign. select id,
idnum,
max(dischargedate) as dischargedate,
case when (race_2 is null) or (race_other is null)
then racecode
when racecode = 'W' and race_2 = 'H'
then 'H'
end as 'Finalrace'
from #All
April 26, 2011 at 7:39 am
Thank you.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply