我的想法是找出重复最多的那条记录,然后再分别找出这些记录。
SELECT count(*) as total, col1, col2, col3 FROM table
WHERE 1 GROUP BY col1, col2, col3
ORDER BY total desc LIMIT 1 这里已经找出col1,col2,col3,然后再搜索这个表中相同的记录
select * from table where col1='$col1' and col2='$col2' and col3='$col3'
SELECT count(*) as total, col1, col2, col3 FROM table
WHERE 1 GROUP BY col1, col2, col3
ORDER BY total desc LIMIT 1 这里已经找出col1,col2,col3,然后再搜索这个表中相同的记录
select * from table where col1='$col1' and col2='$col2' and col3='$col3'
select distinct a.* from tableName a left join tableName b on a.id!=b.id where a.col1=b.col1 and a.col2=b.col2 and a.col3=b.col3
如果是特定的就找这个几个的话如上.
www.mysql.com
枫叶兄,你的方法不错:)结帖。