Skip to content

Tag: duplicates

SQL Finding Dupe Names with Distinct ID

I have a list of customers, and a bunch of them are duplicates (‘Acme Inc’, ‘Acme, Inc’, ‘Acme Inc.’, ‘Acme, Inc.’) They all have different IDs. BUT, each ID also has multiple addresses. Something like… I have a function that normalizes the name so the fir…

Remove duplicates with least row ids from Oracle

I have a database table which looks like ID Book_no Book_name Book_category ID1 1 B1 CB1 ID1 2 B1 CB1 ID1 3 B2 CB1 ID1 4 B2 CB1 ID1 5 B3 CB1 ID2 1 B1 CB2 ID2 2 B1 CB2 ID2 3 B2 CB2 And the expected result is like ID Book_No Book_name Book_category ID1 2 B1 CB1 ID1 4

Select most recent record (with expiration date)

Let’s say that we have 2 tables named Records and Opportunities: Records: RecordID CustomerID CreateDate 777 1 1/1/2021 888 2 1/1/2021 999 1 2/1/2021 Opportunities: OppID CustomerID OppCreateDate 10 1 12/31/2020 11 1 1/10/2021 12 2 2/1/2021 13 1 4/1/2021 14 1 8/5/2025 Desired Output: RecordID CustomerID…