Case in Select Statement

0 votes

I have an SQL statement that has a CASE from SELECT and I just can't get it right. 

     Select xxx, yyy
     case : desc case when bbb then 'blackberry';
     when sss then 'samsung';
     end 
     from (select ???? .....

where the results show

 name                         age       handphone
xxx1                         yyy1      blackberry
xxx2                         yyy2      blackberry
Jun 6 in Ask us Anything! by polo
• 1,500 points
19 views

1 answer to this question.

0 votes

 use:

SELECT CASE
         WHEN upper(t.name) like 'P%' THEN
          'productive'
         WHEN upper(t.name) like 'T%' THEN
          'test'
         WHEN upper(t.name) like 'D%' THEN
          'development'
         ELSE
          'unknown'
       END as type
FROM table t
answered Jun 6 by nisha
• 2,180 points

Related Questions In Ask us Anything!

+1 vote
0 answers
0 votes
0 answers

all values of R in science

Jul 17, 2019 in Ask us Anything! by anonymous
• 120 points
253 views
0 votes
1 answer

Did anyone received the Data Science Hackathon dataset and problem statement

The problem statement and the data set ...READ MORE

answered Jul 24, 2019 in Ask us Anything! by Edureka
• 2,960 points
618 views
–1 vote
0 answers

i want lag in gmail

Jan 7, 2020 in Ask us Anything! by sarah
• 110 points
353 views
0 votes
1 answer
0 votes
2 answers

Case in Select Statement

I think these could be helpful for ...READ MORE

answered Feb 4 in Database by Neha
• 8,740 points
64 views
0 votes
1 answer

How do I perform an IF THEN statement in an SQL SELECT?

The CASE statement is the closest to IF in ...READ MORE

answered Feb 16 in Database by Vaani
• 7,020 points
79 views
0 votes
1 answer

Calculate Time Intersection to Correlate Sequences of Independent Events

I think this solution requires a CROSS JOIN implementation. ...READ MORE

answered Oct 26, 2018 in Power BI by Upasana
• 8,620 points
311 views
0 votes
1 answer

How do I UPDATE from a SELECT in SQL Server?

MERGE INTO YourTable T USING ...READ MORE

answered Feb 3 in Database by Vaani
• 7,020 points
74 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP