摘要: 数据表如下图:1.查询保重的数据,如果名字重名的,取Id大的,如不重名则直接取出select t.* from Table_1 t, (select max(id) id,name from Table_1 group by name) t1 where t.id=t1.id and t.name=t1.name 运行结果:2.查询保重的数据,如果名字重名的,取birth大的,如不重名则直接取出 select * from [Table_1] t where not exists (select 1 from [Table_1] t1 where t.birth < t1.birth . 阅读全文
posted @ 2013-07-01 23:00 stevejson 阅读(1049) 评论(0) 推荐(0) 编辑