August 11, 2015 at 2:41 pm
I've tried a few variations of this, but the error is when I start my from statement: i.e.
this is my last line of my select statement, tried ending the END w/, ;, etc.
Case when dbo.IP_FLWSHT_MEAS.FLO_MEAS_ID in ('3040102809', '3040102810', '7073740', '7073730') then 'Breast Milk P.O or Tube' else
case when dbo.IP_FLWSHT_MEAS.FLO_MEAS_ID in ('3040102811', '304012812') then 'Formula P.O. or Tube' Else 'unknown'
END
FROM bla
August 11, 2015 at 2:47 pm
te_<3 (8/11/2015)
I've tried a few variations of this, but the error is when I start my from statement: i.e.this is my last line of my select statement, tried ending the END w/, ;, etc.
Case when dbo.IP_FLWSHT_MEAS.FLO_MEAS_ID in ('3040102809', '3040102810', '7073740', '7073730') then 'Breast Milk P.O or Tube' else
case when dbo.IP_FLWSHT_MEAS.FLO_MEAS_ID in ('3040102811', '304012812') then 'Formula P.O. or Tube' Else 'unknown'
END
FROM bla
Try
Case
when dbo.IP_FLWSHT_MEAS.FLO_MEAS_ID in ('3040102809', '3040102810', '7073740', '7073730') then 'Breast Milk P.O or Tube'
when dbo.IP_FLWSHT_MEAS.FLO_MEAS_ID in ('3040102811', '304012812') then 'Formula P.O. or Tube'
Else 'unknown'
END
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
August 11, 2015 at 2:53 pm
OMG, that's it, I had an extra 'else'?
thank you thank you thank you thank you thank you thank you thank you thank you thank you
August 11, 2015 at 2:58 pm
te_<3 (8/11/2015)
OMG, that's it, I had an extra 'else'?thank you thank you thank you thank you thank you thank you thank you thank you thank you
You're welcome.
Extra Else and extra Case.
SQL Case statement should only have one Case and one Else, unless you're nesting one Case statement inside another.
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
August 11, 2015 at 3:01 pm
after closer examiniation I realize the extra case as well. Thank you...have a good hour + trying varying combinations of ', and "" use to the if then else not case when 🙂
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply