我的 SQL 查询似乎有问题,这让我发疯。我似乎无法让小组工作。我不断收到以下错误:
00979. 00000 - "not a GROUP BY expression"
我的查询:
SELECT customers.customer_first_name, customers.customer_last_name, orders.customer_numb, books.author_name, books.title
FROM customers
LEFT OUTER JOIN orders ON (orders.customer_numb = customers.customer_numb)
LEFT OUTER JOIN order_lines ON (order_lines.order_numb = orders.order_numb)
LEFT OUTER JOIN books ON (books.isbn = order_lines.isbn)
WHERE (customers.customer_numb = 6)
GROUP BY (books.title)
数据库架构:
顾客:
订单行和订单:
我想要实现的目标: 我正在尝试按书名分组,这样它就不会显示重复的标题。
如果我遗漏了什么,我深表歉意,谢谢。