56,677
社区成员
发帖
与我相关
我的任务
分享
select *
from sql0014 t1
where t1.a > 0
and exists(
select 1
from sql0014
group by b
having max(date)
and max(date) = t1.date
and b = t1.b
)
limit 1,2;
[/quote]
select *
from sql0014 t1
where t1.a > 0
and exists(
select 1
from sql0014
group by b
having max(date)
and max(date) = t1.date
and b = t1.b
)
limit 1,2;
select *
from sql0014 t1
where exists(
select 1
from sql0014
group by b
having max(date)
and max(date) = t1.date
and b = t1.b
) and t1.a >0
limit 1,2;
看能不能达到你的要求?
如果有id的话应该更好判断.