- Query 1
select * from worklog where worklog.recordkey IN
case
when worklog.class ='ACTIVITY' THEN (SELECT wonum from woactivity where parent ='M2176' )
when worklog.class ='WORKORDER' THEN (SELECT WONUM FROM WORKORDER WHERE WONUM = 'M2176')
end ;
- Query 2:
SELECT * from worklog
WHERE CASE WHEN worklog.class='ACTIVITY' THEN
worklog.recordkey in (select wonum from woactivity where parent='M2176' )
end
WHEN worklog.class='WORKORDER' THEN
worklog.recordkey = (select wonum from workorder where wonum='M2176')
end ;
in the above queries I need to set a value in worklog.recordkey. I have two conditions when worklog.class is 'ACTIVITY', I have to set vat value from WOACTIVITY wonum and if worklog.class is 'WORKORDER' then I have to set value from WORKORDER table. When I use the above queries I am getting Errors like:
'Incorrect syntax near the keyword 'in''
and
'Incorrect syntax near the keyword 'case''.
Please help me with this.