【sql去重】sql去重效率语句

本人测试环境oracle

1.本张表去重

select * from XYZX_FRSGSXZXK_LOG A where rowid in ( SELECT MIN(rowid) AS id FROM XYZX_FRSGSXZXK_LOG GROUP BY xk_wsh)

2.本张表去重,和关联表去重

select * from XYZX_FRSGSXZXK_LOG A where rowid in ( SELECT MIN(rowid) AS id FROM XYZX_FRSGSXZXK_LOG GROUP BY xk_wsh) and NOT EXISTS (SELECT xk_wsh FROM CREDITNC.XYZX_FRSGSXZXK B WHERE A.xk_wsh=B.xk_wsh)

你可能感兴趣的:(oracle,sql,Mysql)