oracle pl sql
1 TopicTwo missing record from this query
I have the following query: SELECT '20'||SUBSTR(CAST(T1.LMDTM1 as VarCHar(15)), 2, 6) as Date, T1.LMFSTM as Status, T1.LMREF1 as CustPO, TRIM(T1.LMREF1) ||'-'||TRIM(T1.LMREF2) as Key, T1.LMREF2 as Order, T1.LMREF3 as GUID FROM EXTSYSFCC.EXLLMQLD T1 WHERE t1.LMDTM1 = ( SELECT MAX(t2.LMDTM1) FROM EXTSYSFCC.EXLLMQLD t2 WHERE t2.LMREF2 = t1.LMREF2 ) AND LMTPC1 = 'ABC' AND LMMSID = '123' For some unknown reason to me I detected at least two records that are not included, the date field is 20250217 and the part where it skips those two records, there is at least one record with the same date, is this: t1.LMDTM1 = ( SELECT MAX(t2.LMDTM1) FROM EXTSYSFCC.EXLLMQLD t2 WHERE t2.LMREF2 = t1.LMREF2 ) If I delete that part I can see those two records. Any help will be deeply appreciated. Thanks!67Views0likes2Comments