April 24, 2006 at 9:25 am
Is it possible to write nested case statements. would somebody please provide a sample statement for that?
thanks,
Prema
April 24, 2006 at 9:30 am
Yes, it's possible. e.g.
select
id,
case when id between 1 and 7 then
case when id = 1 then 'one' when id = 2 then 'two' else 'between three and seven' end
when id between 8 and 10 then
case when id = 8 then 'eight'
when id = 9 then 'nine'
when id = 10 then 'ten'
end
else 'bigger than ten'
end as 'pointless description'
from sysobjects
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
April 25, 2006 at 9:19 am
Thanks, I solved my problem
Viewing 3 posts - 1 through 3 (of 3 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