我想看看客户从给定制造商那里订购了什么。
我有这些表(带列):
- 项目(item_num、order_num、stock_num、manu_code、数量等)
- 库存(stock_num、manu_code、description、unit_price 等)
- 订单(order_num、order_date、customer_num、ship_instruct 等)
- 客户(customer_num、fname、lname、company、address1 等)
这是我现在的查询,但我相信它会返回某种叉积:
SELECT concat(c.fname," ", c.lname) AS fullname, s.description
FROM items i, stock s, customer c JOIN orders o
ON o.customer_num=c.customer_num
WHERE o.order_num=i.order_num AND i.manu_code = 'ANZ';
它返回一个包含大量重复项的大列表(1000 行),
Anthony Higgens | baseball gloves
Anthony Higgens | baseball gloves
. .
. .
. .
Kim Satifer | running shoes
我究竟做错了什么?