I have a table with two columns. The first column contains the ID and second one contains the number. I'm trying to find the duplicated records (numbers) and display the numbers with the IDs.
Data
Output
Current query
I'm obviously only getting the duplicated numbers with the number of times it's duplicated with the query above.
Data
Code:
ID NUMBER
D4999 BIN9003
D3955 BIN9003
D5666 BIN9003
B2022 BIN0007
Output
Code:
NUMBER ID1 ID2 ID3
BIN9003 D4999 D3955 D5666
Current query
Code:
SELECT NUMBER, COUNT(ID) AS Dupes
FROM TABLE
GROUP BY NUMBER
HAVING (COUNT(ID)>1);
I'm obviously only getting the duplicated numbers with the number of times it's duplicated with the query above.