Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL Query to get Unique Records from Based on Start Date, Emp Num, Batch

User_EVWYZOct 15 2021

Hi All,
Need help on the SQL Query
We have a Table
image.png
The Query need to fetch unique records based on combination of Batch, Emp No and Max Date
image.pngTried the below query, but it is not fetching the desired results

SELECT
Table__14.UNIQUE_TRANSACTIONID,
Table__14.BATCH_NUMBER,
Table__14.EMP_NUM,
MAX(to_date(Table__14.START_DATE))
FROM
DI_CAPTURE Table__14
WHERE
Table__14.STATUS <> 'REJECTED'
GROUP BY Table__14.UNIQUE_TRANSACTIONID,Table__14.BATCH_NUMBER,Table__14.EMP_NUM,Table__14.START_DATE

Comments

Post Details

Added on Oct 15 2021
5 comments
884 views