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
SHIVAM SINGH
NA
18
29.4k
set default value in select statement using case
Nov 22 2014 5:36 AM
Hi all,
I want to write a query that will produce result when row has null value then white else green but it is not working. My Query is given bellow
select
ExamQuestionDetail.qid,ExamUserAnswers.color,(
case
when
ExamUserAnswers.color=
null
then
'white'
else
'Green'
end
)
as
newcolor
from
ExamQuestionDetail
left join
ExamUserAnswers
on
ExamUserAnswers.Qid=ExamQuestionDetail.qid
but i am getting wrong result as bellow i have mention
qid
color
newcolor
22 Green Green
23 NULL Green
24 NULL Green
25 NULL Green
26 NULL Green
27 NULL Green
28 NULL Green
29 NULL Green
30 NULL Green
32 NULL Green
34 NULL Green
36 NULL Green
37 NULL Green
38 NULL Green
39 NULL Green
40 NULL Green
41 NULL Green
42 NULL Green
43 NULL Green
44 NULL Green
45 NULL Green
46 NULL Green
47 NULL Green
48 NULL Green
49 NULL Green
50 NULL Green
51 NULL Green
52 NULL Green
53 NULL Green
54 NULL Green
55 NULL Green
56 NULL Green
57 NULL Green
58 NULL Green
59 NULL Green
60 NULL Green
61 NULL Green
62 NULL Green
63 NULL Green
64 NULL Green
65 NULL Green
66 NULL Green
67 NULL Green
68 NULL Green
70 NULL Green
71 NULL Green
72 NULL Green
73 NULL Green
74 NULL Green
75 NULL Green
76 NULL Green
77 NULL Green
78 NULL Green
79 NULL Green
80 NULL Green
81 NULL Green
82 NULL Green
83 NULL Green
84 NULL Green
85 NULL Green
86 NULL Green
87 NULL Green
88 NULL Green
89 NULL Green
90 NULL Green
91 NULL Green
92 NULL Green
Reply
Answers (
2
)
how i use store procedure for joins(inner join) and rules .
What mean Super key?EX Query