一条sql语句,求高手
表数据:
id email number
1 aa@qq.com 00001
2 bb@qq.com 00001
3 cc@qq.com 00002
4 dd@qq.com 00002
需要的结果是:
id email number
1 aa@qq.com 00001
3 cc@qq.com 00002
sql语句怎么写?
------解决方案--------------------
SQL code
select * from tb t
where not exists(select 1 from tb where number=t.number and id<t.id)