select * from tt a where exists(select 1 from tt where a.currency=currency and a.creationtime<creationtime) and a.currency in(1,2,3)
select * from tt a where not exists(select 1 from tt where a.currency=currency and a.creationtime<creationtime) and a.currency in(1,2,3)
你的sql 是可行的自己刚琢磨写了一条。貌似可行。 SELECT * FROM exchangerate e WHERE currency IN (1,2,3) AND creationTime = (SELECT MAX(creationTime) FROM exchangeRate AS e2 WHERE e2.currency=e.currency )
你的sql 是可行的自己刚琢磨写了一条。貌似可行。
SELECT * FROM exchangerate e WHERE currency IN (1,2,3)
AND creationTime = (SELECT MAX(creationTime) FROM exchangeRate AS e2 WHERE e2.currency=e.currency )
[征集]分组取最大N条记录方法征集,及散分....