Having a syntax error and can someone help?
select imtpartid, imtCreatedDate from parttransactions where imtpartid = 'XYZ' and imtpartrevisionid = 'A' and (case imtsource when 9 then (imtCreatedDate = (select max(A.imtCreatedDate) from parttransactions A where A.imtpartid = parttransactions.imtpartid and A.imtpartrevisionid = parttransactions.imtpartrevisionid) and imtTransactionType = 2)
else (imtCreatedDate = (select max(A.imtCreatedDate) from parttransactions A where A.imtpartid = parttransactions.imtpartid and A.imtpartrevisionid = parttransactions.imtpartrevisionid)) end)
select imtpartid, imtCreatedDate from parttransactions where imtpartid = 'XYZ' and imtpartrevisionid = 'A' and (case imtsource when 9 then (imtCreatedDate = (select max(A.imtCreatedDate) from parttransactions A where A.imtpartid = parttransactions.imtpartid and A.imtpartrevisionid = parttransactions.imtpartrevisionid) and imtTransactionType = 2)
else (imtCreatedDate = (select max(A.imtCreatedDate) from parttransactions A where A.imtpartid = parttransactions.imtpartid and A.imtpartrevisionid = parttransactions.imtpartrevisionid)) end)