# 子查询k1-----先查询各电影id的最新分类
select film_id, category_id
from film_category f
where last_update = (
select max(last_update) max_date
from film_category
where (film_id, category_id) = (f.film_id, f.category_id)
)
# 完整查询-----查询属于Action分类的所有电影对应的title,description
select title, description
from (
select *
from category
where name = 'Action'
) k1
join (
select film_id, category_id
from film_category f
where last_update = (
select max(last_update) max_date
from film_category
where (film_id, category_id) = (f.film_id, f.category_id)
)
) k2
on k1.category_id = k2.category_id
join film f
on f.film_id = k2.film_id;