美剧有id,name两个字段
剧集有id,v_id,name,data
取最新的剧集和美剧的信息,旧的不要。
就是说的到的数据列表美剧id是唯一的,每个美剧id的数据有最新的剧集信息。
SQL 主从表
------解决方案--------------------
select a.*,b.name,b.data
from 主表 as a
inner join 从表 as b on a.ID=b.v_id
where not exists(select 1 from 从表 where v_id=b.v_id and id>a.id)
------解决方案--------------------
select a.*,b.name,b.data
from 主表 as a
inner join 从表 as b on a.ID=b.v_id
where not exists(select 1 from 从表 where v_id=b.v_id and [date]>a.[date])
把ID改为Date