如何能取出重复记录中的第一条记录? select * from 表 tem where id=(select min(id) from 表 where name=tem.name) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 或:select * from 表 tem where id=(select top 1 id from 表 where name=tem.name) select * from table a where id=(select min(id) from table where name=a.name)orselect min(id) id ,name from table group by name select * from 表 tem where id=(select top 1 id from 表 where name=tem.name order by id) 本例中,如下即可:Select name,min(id) as id from 表 group by name select * from 表 aa where not exists(select 1 from 表 bb where aa.name=bb.name and aa.id>bb.id) select * from tablename tem where id=(select min(id) from tablename where name=tem.name) select min(id),name from table1 where name in(select distinct name from table1); 分组查询的问题 如何将'1,2,3'分成三行? access 比较日期 急急急!!! 分组时按组来限制返回的记录条数,如何可以做到? 请教一条SQL语句 如何在MS-SQL中根据前一列的日期,生成另外一列结果 如何查出多条数据日期重叠的部分 为什么我问的关于DB2的问题总是没有人回答啊?!郁闷中。。。 请问各位数据库高手一个问题! sql server 安装问题 SQL紧急求教 请问这一列的约束在哪里可以找到?
select * from 表 tem where id=(select top 1 id from 表 where name=tem.name)
Select name,min(id) as id from 表 group by name