显示产品列表之类的内容的 sql 语句是什么
what is the true sql statement for show something like list of products
如何在图片
中显示客户"Peacock cafe bar"购买的产品(description
,serial number
,price
)
我显示 3 个表
我试过
select
from ...
where(
select
from ...
as ...
where
“”
)
我记得你应该在你的表上使用联合查询,比如:
select * from ProductsTable as Products
join
(select Buys.ProCode from CustomerTable as Customer
join BuysTable as Buys
on Customer.code = Buys.custcode) as customerbuys
on Products.code = customerbuys.ProCode
尝试这样的事情:您将希望通过它们的键连接您的表,然后像这样在 WHERE 子句中过滤结果。
SELECT
p.pr_serial
, p.pr_descr
, p.pr_price
FROM Customers AS c
JOIN Buys AS b
ON c.cust_code = b.cust_code
JOIN Products AS p
ON b.pr_code = p.pr_code
WHERE c.cust_name = 'Peacock cafe bar';
如何在图片
中显示客户"Peacock cafe bar"购买的产品(description
,serial number
,price
)
我显示 3 个表
我试过
select
from ...
where(
select
from ...
as ...
where
“”
)
我记得你应该在你的表上使用联合查询,比如:
select * from ProductsTable as Products
join
(select Buys.ProCode from CustomerTable as Customer
join BuysTable as Buys
on Customer.code = Buys.custcode) as customerbuys
on Products.code = customerbuys.ProCode
尝试这样的事情:您将希望通过它们的键连接您的表,然后像这样在 WHERE 子句中过滤结果。
SELECT
p.pr_serial
, p.pr_descr
, p.pr_price
FROM Customers AS c
JOIN Buys AS b
ON c.cust_code = b.cust_code
JOIN Products AS p
ON b.pr_code = p.pr_code
WHERE c.cust_name = 'Peacock cafe bar';