select 要使用字段1,要使用字段2 from 表名 where id in (select min(id) from 表名 group by 不重复字段名)
比如:
select myid,id from chat where id in (select min(id) from chat group by myid)