Thursday, September 8, 2022

SQL select statement inside CASE statement

 select level_name=case when Course_level_id=5 then (case when 

((select Course_Entryon from MST_COURSE where course_id=454 ) >= '2022-04-01' ) then 'L5-L6'

when ((select Course_Entryon from MST_COURSE where course_id=454) = '')  then 'L5'

when ((select Course_Entryon from MST_COURSE where course_id=454) is NULL)  then 'L5'

else level_name end) else level_name end from dbo.MST_COURSE_LEVEL

where Course_level_id=(select distinct(Course_level_id) from MST_COURSE where course_id=454)

No comments:

Post a Comment