当前位置: 代码迷 >> Sql Server >> sql数据库查询语句有关问题,快一天了,没有好的解决方案,求大家帮忙
  详细解决方案

sql数据库查询语句有关问题,快一天了,没有好的解决方案,求大家帮忙

热度:9   发布时间:2016-04-24 23:10:38.0
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)
  相关解决方案