The SQL statement case when problem, urgent, and great help!



The existing business form a column of data table above, first need to use the SQL statement screening data, let it with "clinic" two word column showed "outpatient", with "emergency" two words show "emergency", the SQL statement is as follows:
select
case when '%Outpatient service 'then' in 'else' emergency' end clinic_label as a
from fact_clinic_master
Query with the statement, obtained results are all 'emergency', I would like to ask whether this can not be used? ?

Started by Eli at November 17, 2016 - 9:34 PM

select
case when clinic_label like '%Outpatient service 'then' in 'else' emergency' end clinic_label as a
from fact_clinic_master

Posted by Richard at November 24, 2016 - 9:40 PM

Your grammar.?

Posted by Richard at December 03, 2016 - 9:45 PM

select (case when clinic_label LIKE '%Outpatient service 'then' in 'else' emergency' END)as a 
from fact_clinic_master

Posted by Cora at December 08, 2016 - 9:57 PM

Method 1, your writing, with a slight change of the ha
select 
    case when clinic_label like'%The 'then' outpatient clinic' 
         else 'Emergency treatment' end  as a 
from fact_clinic_master


Method 2
select 
    case when charindex('Clinic ', clinic_label) > 0 then' clinic;' 
         else 'Emergency treatment' end  as a 
from fact_clinic_master

Posted by Caroline at December 17, 2016 - 10:48 PM


select case when clinic_label LIKE '%Outpatient service 'then' in 'else' emergency' END as a 


from fact_clinic_master

Posted by Barry at December 22, 2016 - 10:58 PM

Yes ah, moderators adults, but the wrong you. .

Posted by Eli at January 04, 2017 - 11:31 PM

Well, check library, thank you sir, moderators adults long live.. Fix!

Posted by Eli at January 10, 2017 - 12:05 AM

Debug library is not should be no data or directly to the wrong?

Posted by Richard at January 12, 2017 - 12:27 AM