读书人

sql数据库查询语句有关问题快一天了

发布时间: 2013-04-02 12:35:26 作者: rapoo

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

想要的结果,标记黑色的时希望剩余结果
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)

读书人网 >SQL Server

热点推荐