Hi,
Train Dest Time
1 HK 10:00
1 SH 12:00
1 SZ 14:00
2 HK 13:00
2 SH 09:00
2 SZ 07:00
Expected output
Train Dest Time
1 SZ 14:00
2 HK 13:00
Distinct ( max(AccountingDate) and group by (SubLedgerVoucherDataAreaID) from GeneralJournalEntry )
distinct (GROUP BY with MAX(DATE) [duplicate] )
/**************************/
SELECT GJE.SubLedgerVoucherDataAreaID, MAX(GJE.AccountingDate) as MaxDate
FROM GENERALJOURNALENTRY GJE
GROUP BY GJE.SubLedgerVoucherDataAreaID
Thanks,