我得到一个错误,说输出与给定的问题不匹配
sakila数据库: https://dev.mysql.com/doc/sakila/en/sakila-structure.html
下面是我的代码
with temp as (
select concat(b.first_name, ' ',b.last_name) as name,
count(a.rental_id >= 1) as rental_count
from rental a
inner join customer b ON (a.customer_id=b.customer_id)
inner join address c ON (b.address_id=c.address_id)
inner join city d ON (c.city_id=d.city_id)
where d.city like "Arlington"
group by name
order by rental_count
)
select name from temp
预期结果是
full names of those customers who have rented at least one movie and belong to the city Arlington.
你能告诉我是什么错误吗?或者有别的办法吗?
2条答案
按热度按时间drnojrws1#
你可以使用
having
子句,请尝试以下操作olqngx592#