列出与客户编号282具有相同代表编号的客户编号,客户名称和销售代表。这将需要是子查询,不要显式测试销售代表35。让MySQL为您完成工作。在此处插入您的查询和结果。
use premier_products;
select customer.customer_num,customer.customer_name,rep.first_name
(SELECT rep_num
from rep,customer
where rep.rep_num = customer.rep_num
and customer_num = 282)
from customer,rep;
我对如何使用以下问题形成子查询感到困惑。两个表之间只有两个相关的文件是rep.rep_num = customer.rep_num。
AND REP.FIRST_NAME REFERS TO SALES REP ...
答案 0 :(得分:1)
您需要学习tables Join in MySql。
您的查询不需要子查询:
SELECT customer.customer_num, customer.customer_name, rep.first_name, rep.rep_num
FROM rep
JOIN customer
ON rep.rep_num = customer.rep_num
WHERE customer_num = 282;