select * from table_a a
left join table_b b on a.aid=b.bid
and not exits(
select 1 from table_b T
where b.bid = t.bid
and b.date < t.date
)
你看条件啊,no exits括号里面是查询吧,读懂就知道了
not exits 中的表与外面的table_b表是同一张表,not exits中的子查询不可能存在这样的条件结果b.bid = t.bid
and b.date < t.date,所以not exits中的子查询写了等于没写