我想找到销量最高的书。
这是我的数据库的架构:
publisher(p_id,pub_name)
book(ISBN,tile,price,year,p_id);
warehouse(code,address,zone,phone)
customer(c_id,cust_name,phone,email)
shopping_B(s_id,s_date,c_id)
access_s(ISBN,code,s_id,quantity)
我尝试了下面给出的查询,但没有给出最大销售金额的书:
select book.title, max(book.price * access_s.quantity) as MAX_sale
from book, access_s, shopping_B, customer
where book.ISBN=access_s.ISBN and shopping_B.s_id=access_s.s_id and shopping_B.c_id = customer.c_id
group by title