且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 2 列而不是 1 列中查找重复项

更新时间:2022-11-13 21:15:38

你应该在两个字段之间设置一个复合键.这需要每行都有一个唯一的 stone_id 和 upcharge_title.

You should set up a composite key between the two fields. This will require a unique stone_id and upcharge_title for each row.

只要找到现有的重复项,试试这个:

As far as finding the existing duplicates try this:

select   stone_id,
         upcharge_title,
         count(*)
from     your_table
group by stone_id,
         upcharge_title
having   count(*) > 1