I have to update some date fields in a file where certain conditions are met in other files. I haven't used SQL for updates much but found a sample that I adapted for my situation:
update a
set a.lmdcnt = 082014, a.lmdtlc = '2014-08-20'
from mylib/fklocmst a
join comastf b
on a.lmco = b.cmcomp
join fkitmstr c
on a.lmco = c.imco and a.lmpn = c.impn
where a.lmpn <> ' ' and a.lmdtlc = '0001-01-01' and
b.cmmast = 510 and b.cmsts = ' ' and c.imabc in ('D', 'E')
While this should work if the example I found is valid, I get "Keyword FROM not expected". I was trying to avoid using subselects in my where clause but will if I have to. Recommendations/examples?
update a
set a.lmdcnt = 082014, a.lmdtlc = '2014-08-20'
from mylib/fklocmst a
join comastf b
on a.lmco = b.cmcomp
join fkitmstr c
on a.lmco = c.imco and a.lmpn = c.impn
where a.lmpn <> ' ' and a.lmdtlc = '0001-01-01' and
b.cmmast = 510 and b.cmsts = ' ' and c.imabc in ('D', 'E')
While this should work if the example I found is valid, I get "Keyword FROM not expected". I was trying to avoid using subselects in my where clause but will if I have to. Recommendations/examples?
Comment