Hello all. I am a mainframe programmer trying to make changes to a report in crystal reports. The following statement works correctly in sql. The problem I am having is adding the case logic to crystal reports.
SELECT
optionee."NAME_FIRST",
optionee."NAME_MI",
optionee."NAME_LAST",
optionee."LOC_CD",
optionee."SOC_SEC",
case
(select count(*) from user3_leview where le_branch=loc_cd)
when 0 then 'XX'
else case (select count(*) from user3_leview where le_branch=loc_cd
and le_year = Left(Cast(YEAR(exercise.EXER_DT) as Char),4))
when 0 then ''
else (select item_desc from user3_leview where le_branch=loc_cd
and le_year = Left(Cast(YEAR(exercise.EXER_DT) as Char),4))
end
end as "Descr",
grantz."OPT_PRC",
grantz."GRANT_DT",
exercise."Grant_NUM",
exercise."OPTS_EXER",
exercise."EXER_DT",
valuations."OPTION_VAL"
FROM
((SO01DB.dbo.optionee optionee
INNER JOIN SO01DB.dbo.grantz grantz ON optionee.OPT_NUM = grantz.OPT_NUM
LEFT OUTER JOIN SO01DB.dbo.exercise exercise ON optionee.OPT_NUM =
exercise.OPT_NUM AND grantz.GRANT_NUM = exercise.GRANT_NUM)
WHERE
grantz.PLAN_TYPE = 1 OR grantz.PLAN_TYPE = 4 oR grantz.PLAN_NUM = 5
If anyone could point me in the right direction it would be greatly appreciated.
Thank you.