我试图将这4张表联系起来,但我一直遇到问题。有没有人知道为什么?
Part (
part_num,
description,
on_hand
)
Order (
order_num,
date,
customer_id
)
Order_line (
part_num,
order_num,
price
)
Customer (
customer_ID,
customer_name
)
我正在尝试为名称为order_num
和说明date
的{{1}}提取customer
和"raymond"
。
"stove"
我点击了输入,显示为:SELECT order.order_num, date
FROM order, part, order_line, customer
WHERE order.order_num = order_line.order_num
AND part.part_num = order_line.part_num
AND order.customer_id = customer.customer_id
AND customer_name = 'raymond'
AND description = 'stove' ;
而不是,>
答案 0 :(得分:0)
您需要选择part.part_num
,如下所示,同时转发order
它是一个关键字:
Select part.part_num,date
from `order`, part, order_line, customer
where `order`.order_num = order_line.order_num
and part.part_num = order_line.part_num
and `order`.customer_id = customer.customer_id
and customer_name = 'raymond'
and description = 'stove' ;