Also be aware that there's a gotcha when using WHERE abc NOT IN (SELECT
xyz FROM ...) that has bitten me a few times in the past...
Perhaps not an issue in this scenario because it's an ID and likely NOT
NULL, but if the select subquery ever returns a NULL value for xyz the
condition
Yikes looks so simple once the answer is here haha. I’ll check in the
morning if the Id is unique across the board. Thanks I appreciate the help.
Regards
Tom
On Thu, 17 Nov 2022 at 17:27, Alan Ingleby via ozdotnet <
ozdotnet@ozdotnet.com> wrote:
> If the ID is unique across all records,
>
>
If the ID is unique across all records,
SELECT * FROM WHERE ID NOT IN (SELECT MAX(ID) FROM
GROUP BY NAme,Desc,Date,Etc)
On Thu, 17 Nov 2022 at 16:02, Tom P via ozdotnet
wrote:
> Apologies if this is basic for probably most of you but I just can't get
> my head around it.
>
> I have a flat
;https://sqldownunder.com/> |
About Greg: https://about.me/greg.low
From: Tom P via ozdotnet
Sent: Thursday, 17 November 2022 5:01 PM
To: ozDotNet
Cc: Tom P
Subject: [OT] Finding duplicate rows in Sql Server
Apologies if this is basic for probably most of you but I just can't get my
head around it
Apologies if this is basic for probably most of you but I just can't get my
head around it.
I have a flat table in sql server which contains lots of duplicates,
differing only by one column.
Id,Name,Desc,Date,Etc
1,abc,abc abc,2022-11-17,a
2,abc,abc abc,2022-11-17,a
5,def,def def,2022-11-17,a