I have an If
statement written in Crystal report that I wanted to convert to SQL code. The first code block is the Crystal report code; the last code block is the SQL code. Thank You!!
If {Command.TRT} = '23' then
( if {Command.CAT} = '200' or {Command.CAT} = '300' then 'Home'
else {Command.CAT} ='111' or {Command.CAT} = '22A' then 'School'
else "Other: " & {Command.CAT} )
else
if {Command.TRT} = '20' then (
if {Command.CAT} = '220' or {Command.CAT} = '400 then 'Homework'
else "Other: " & {Command.CAT} )
)
Case When TRT = '23' and CAT = '200' or CAT = '300' then 'Home'
when TRT = '23' and CAT = '111' or CAT = '22A' then 'School'
else
Case When TRT = '20' and AT = '220' or CAT = '400 ' then 'Homework'
else Concat('Other: ',CAT)