I am joining 3 queries with a UNION and when I get the results I want to only get one row for each lot determined by the MAX(PDATETIME). I can not group by the other columns as they differ and I can also not MAX these to get past this.This SQL will in turn be used by a different program which can not use analytical functions so rank or row_number are out the window too.
I have that nagging feeling that Im forgetting something very basic to fix this. Can you let me know what you think please?
ALUM_HIST.PDATETIME >= SYSDATE -4 AND ALUM_HIST.MACH LIKE 'CPT%'
ALD_HIST.PDATETIME >= SYSDATE -4
(GAPDEP_HIST.MACH LIKE '602%' OR GAPDEP_HIST.MACH LIKE 'COR%') AND GAPDEP_HIST.PDATETIME >= SYSDATE -4
ORDER BY LOT