如何一句SQL得到每个Symbol的Time最晚的3条记录 本帖最后由 ACMAIN_CHM 于 2013-05-17 09:22:15 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 参考下贴中的多种方法http://blog.csdn.net/acmain_chm/article/details/4126306[征集]分组取最大N条记录方法征集,及散分.... select *from tb Awhere not exists(select 1 from tb where symbol=A.symbol and A.val=val and A.time<time) select *from tableName twhere 3>=(select count(*) from tableName where Symbol=t.Symbol and Time>=t.Time); SELECT * FROM news a WHERE 3>(SELECT COUNT(*) FROM news WHERE a.Symbol=Symbol AND a.`time`<=`time`) select * from tbcsdn awhere 3>(select count(*) from tbcsdn b where a.symbol=b.symbol and a.time<b.time) mysql赋值操作符问题 mysql 关于临时表的问题 pl/pgsql高手请进,急,先谢过了 我用odbc连接vc.net怎么总是非法? 请问如何在LINUX下执行MYSQL的*.sql文件 这种查询如何做,效率如何? mysql update where 如果空列,能不能update? 请高手帮忙分析my.ini配置,谢谢! mysql影响行数是什么意思? 新手求教批量更新问题,100W+数据量 求解一个数据库问题 存储过程问题
[征集]分组取最大N条记录方法征集,及散分....
from tb A
where not exists(select 1 from tb where symbol=A.symbol and A.val=val and A.time<time)
from tableName t
where 3>=(select count(*) from tableName where Symbol=t.Symbol and Time>=t.Time);
select *
from tbcsdn a
where 3>(select count(*) from tbcsdn b where a.symbol=b.symbol and a.time<b.time)