December 17, 2019 at 11:12 pm
Hi,
while I don't yet have any code to show I am trying to find duplicates in a table. So I revert to excel logic here in that if I were working in that however many columns I had, I would take the values from every cell in a row and I would concatenate to produce a unique value. Then I would identify duplicates. How do you do this in SQL? Having count >1 is part of it but how do you ensure the check is done on a unique concatenation of values
Thanks!
December 18, 2019 at 1:32 am
If I have a table:
CREATE TABLE EMP
(
ID int
, NAME varchar(50)
, TITLE varchar (20)
);
GO
INSERT INTO EMP
VALUES
(1, 'Joe Cool', 'CEO')
, (1, 'Joe Cool', 'CEO')
. (2. . 'Snoopy', .'pet');
GO
SELECT ID, NAME, TITLE
FROM EMP
GROUP BY ID, NAME, TITLE
HAVING COUNT(*)>1;
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy