MySQL Forums
Forum List  »  Newbie

Re: Listing Duplicate Rows
Posted by: Ray Rose
Date: March 24, 2005 04:32PM

For reporting purposes. I am dealing with workers compensation codes and I need to find duplicates workers compensation codes which may have more than a single hazard group assigned to it and are non-excluded.

Here's an example I came up with which I was trying to put into a sub-select:

SELECT wc_code FROM wc_codes WHERE excluded='N' GROUP BY wc_code HAVING COUNT(wc_code)>1

This pulls all WC Codes which are found more than once and are non-excluded workers compensation codes. I was tring to combine a sub-select like this:

SELECT wc_code, hazard_group, state FROM wc_codes WHERE wc_code = (SELECT wc_code FROM wc_codes GROUP BY wc_code HAVING COUNT(wc_code)>1)

My version of MySQL (4.0.22) will not accept this though. :-(

Options: ReplyQuote


Subject
Written By
Posted
March 24, 2005 03:42PM
March 24, 2005 04:14PM
March 24, 2005 04:23PM
March 24, 2005 04:25PM
Re: Listing Duplicate Rows
March 24, 2005 04:32PM
March 24, 2005 04:36PM
March 24, 2005 07:02PM
March 24, 2005 07:10PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.