Mysql 每个派生表都必须有自己的别名can';我找不到错误
我想找到销量最大的那本书的作者,但它显示了错误。这有什么问题?在from子句之后使用别名Mysql 每个派生表都必须有自己的别名can';我找不到错误,mysql,mysql-error-1248,Mysql,Mysql Error 1248,我想找到销量最大的那本书的作者,但它显示了错误。这有什么问题?在from子句之后使用别名 select a.author_id,a.name,a.city,a.country from author a,catalog c where c.author_id=a.author_id and c.book_id=(select book_id from order_details group by book_id having sum(quantity)=(select max(quant
select a.author_id,a.name,a.city,a.country from author a,catalog c
where c.author_id=a.author_id
and c.book_id=(select book_id from order_details
group by book_id
having sum(quantity)=(select max(quantity)
from (select sum(quantity) as quantity from order_details group by book_id)));
你应该试试这个,如果问题解决不了,请联系我
select a.author_id,a.name,a.city,a.country
from author a,
catalog c
where c.author_id=a.author_id
and c.book_id=(select book_id
from order_details
group by book_id
having sum(quantity)=(select max(quantity)
from (select sum(quantity) as
quantity
from order_details
group by book_id)
)a
);
显示表结构和期望输出
,但它显示错误
哪个错误?请注意。错误是每个派生表都必须有自己的别名
select a.author_id,a.name,a.city,a.country
from author a,catalog c
where c.author_id=a.author_id
and c.book_id=(select book_id
from order_details d
group by d.book_id
having sum(quantity)=(select max(e.quantity )
from (select sum(dd.quantity) as quantity
from order_details dd
group by dd.book_id) as e ) );