找出或检查prs_code
重复item_code
的所有coll1
的最佳方法是什么?
答案 0 :(得分:0)
您可以分组并查找任何2个或更多的计数(它们将被欺骗):
SELECT COUNT(*) AS cnt, prs_code, item_code
FROM whatever_you_call_your_table
GROUP BY prs_code, item_code
HAVING cnt > 1
答案 1 :(得分:0)
查询:
SELECT *
FROM tbl_name
GROUP BY item_code
HAVING COUNT(*) > 1