假定有一个Order表,有三列orderid,orderRef,customerid
如果要查看这三列的重复数据,暂时想到的SQL语句如下:
insert into orders values(1,'order123',1)
insert into orders values(1,'order123',1)
insert into orders values(2,'order223',2)
insert into orders values(2,'order223',2)
insert into orders values(3,'order456',3)
insert into orders values(3,'order456',3)
insert into orders values(4,'order456',3)
select orderid,orderRef,customerid from Orders
group by orderid,orderRef,customerid
having count(orderid) > 1 and count(orderRef) > 1 and count(customerid) > 1