TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Subin Thomas
NA
4.9k
127.1k
how to write a case in sql ?
Apr 2 2019 5:40 AM
select
case
a.[RoleName] =
'student'
then
'its student'
when a.[RoleName] =
'teacher'
then
'its teacher'
when a.[RoleName] =
'princi'
then
'its principal'
else
'attendant'
end from Roles]as a
inner join RoleDetails as b on
RoleId=b.RoleId
where b.Reserveid=
'18'
i am getting an error at 02,03,04 line at "="
error: incorrect syntax near =
whats wrong in this query if anyone can help me
thanks,
subin.
Reply
Answers (
8
)
how to write a query having multiple conditions ?
how to save sql string result in a variable ?