表数据:
id email number
1 [email protected] 00001
2 [email protected] 00001
3 [email protected] 00002
4 [email protected] 00002
需要的结果是:
id email number
1 [email protected] 00001
3 [email protected] 00002
sql语句怎么写?
------解决方案--------------------
- SQL code
select * from tb twhere not exists(select 1 from tb where number=t.number and id<t.id)