Chris W wrote:
Chris wrote:
Chris W wrote:
Suppose I have table t with fields k1, k2 and k3 that all make up the
primary key. Then I have fields x, y and z. If fields x, y and z
all have the same values in more than one row, there is a good chance
they are duplicate records. What is the best way to list all of the
rows where this condition exists?
Something like:
select k1, k2, k3 from table group by k1, k2, k3 having count(*) > 1;
I don't think I was clear, x, y, and z are not the only rows in the
table and the group of k1, k2, k3 will always be unique as it is a
unique primary key.
Adjust the query:
select x, y, z from t group by x,y,z having count(*) > 1;
That will tell you which values of x,y,z you need to look at.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]