查詢表中重復或不重復的記錄,要求顯示所有字段
1. 打開重復記錄的單個字段:
select distinct name from table
2. 打開重復記錄的所有字段值:
select * from table where fid in(select min(fid) from table group by name)
假定:name字段包含重復值
3. 打開重復任意次數(shù)的所有記錄:
select * from table where name in(select name from table group by name having count(name)=1)
select distinct name from table
2. 打開重復記錄的所有字段值:
select * from table where fid in(select min(fid) from table group by name)
假定:name字段包含重復值
3. 打開重復任意次數(shù)的所有記錄:
select * from table where name in(select name from table group by name having count(name)=1)
posted on 2012-04-18 14:46 koradji 閱讀(306) 評論(0) 編輯 收藏 所屬分類: database