日期:2014-05-17  浏览次数:20442 次

sql数据库查询语句问题,快一天了,没有好的解决方案,求大家帮忙
分数不多,希望大家帮忙,谢谢
我现在查询结果


想要的结果,标记黑色的时希望剩余结果

------解决方案--------------------

select * from 表名 a 
where m_datetime=(select min(m_datetime) from 表名 where m_devicecode=a.m_devicecode)

------解决方案--------------------
select * from tb a 
where not exists
(select 1 from tb where m_devicecode=a.m_devicecode and m_datetime<a.m_datetime)