mysql 子查询问题

2025-04-05 08:50:48
推荐回答(2个)
回答1:

select * from b where 时间字段 > (select 时间字段 from a where a.id=xxxx) litmi 1;

回答2:

a
id time
1 324523
2 234324
b
id aid time
1 2 234
2 2 5435
3 1 34543
4 1 32543

select * from (select b.* from b
join a on b.id = a.id and b.time < a.time
order by b.aid, b.time desc ) as c group by c.aid ;