我想從pur_head_v3這個表中找出相同的記錄,用以下兩個語句均查不出來,是不是語句有問題,
select * from pur_head_v3 a where (select count(*) from pur_head_v3 b where a.pur_type=b.pur_type and a.pur_t_no=b.pur_t_no and a.pur_d_no=b.pur_d_no)>1;
select * FROM pur_head_v3 A WHERE A.ROWID > (SELECT MIN(B.ROWID) FROM pur_head_v3 B where a.pur_type=b.pur_type and a.pur_t_no=b.pur_t_no and a.pur_d_no=b.pur_d_no)
如果沒有問題,為什麼我用select count(t.pur_type||t.pur_t_no||t.pur_d_no) from pur_head_v3 t 得到的結果為:1192827
而用 select count(distinct t.pur_type||t.pur_t_no||t.pur_d_no) from pur_head_v3 t 得到的結果為:1188217
select * from pur_head_v3 a where (select count(*) from pur_head_v3 b where a.pur_type=b.pur_type and a.pur_t_no=b.pur_t_no and a.pur_d_no=b.pur_d_no)>1;
select * FROM pur_head_v3 A WHERE A.ROWID > (SELECT MIN(B.ROWID) FROM pur_head_v3 B where a.pur_type=b.pur_type and a.pur_t_no=b.pur_t_no and a.pur_d_no=b.pur_d_no)
如果沒有問題,為什麼我用select count(t.pur_type||t.pur_t_no||t.pur_d_no) from pur_head_v3 t 得到的結果為:1192827
而用 select count(distinct t.pur_type||t.pur_t_no||t.pur_d_no) from pur_head_v3 t 得到的結果為:1188217