Jump to content

Recommended Posts

I have a table called AADETAILS with two colums ('Name' and 'ID').

The ID column is not supposed to have any duplicates, so I need a query that returns a list of all the duplicate ID's (with their Name). For example, if there is an ID with a value of 123 duplicated three times and an ID with a value of 456 duplicated four times, I need a list of the Name and ID of the three instances of 123 and the four instances of 456.

I have the following :

SELECT Name, ID
FROM AADETAILS
GROUP BY Name, ID
HAVING COUNT(ID) > 1

its not returning anything, but it should (I can see the duplicates in the table if I view all the data in it), whats wrong with that query ?

Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/53568-solved-selecting-duplicate-values/
Share on other sites

Thanks, when I try and run the query it gives the following error:

Error starting at line 1 in command:
SELECT id , GROUP_CONCAT(name ORDER BY name SEPARATOR ', ') as names
FROM aadetails
GROUP BY id
HAVING COUNT(*) > 1
Error at Command Line:1 Column:30
Error report:
SQL Error: ORA-00907: missing right parenthesis

 

I've tried playing around with the parenthesis but nothing doing.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.