我有一张下表
id group name
1 2 dodo
2 1 sdf
3 2 sd
4 3 dfs
5 3 fda
....
我想从每个小组获取介绍记录,如下面的
id group name
... 1 sdf
2 dodo
3 dfs
...
答案 0 :(得分:1)
SELECT MIN(id) id, group, name
FROM TABLE1
GROUP BY group
ORDER BY group
答案 1 :(得分:0)
select * from table_name where id in (select min(id) from table_name group by group)