SQL问题: 怎样取出某一字段的所有不重复记录?
比如有张表
NAME EMP
WANG A
LI B
ZHANG A
LI C
YAO C
要取出该表NAME字段不重复的所有记录
即
WANG A
LI B
ZHANG A
YAO C
1.
-
select * from tablename where rowid in (select min(rowid) from tablename group by name)
2.
-
select name,max(emp) from tbname group by name;