我需要显示cust_id,客户姓名和姓氏,产品名称<-(从产品表)和销售日期<-(从销售表),我还需要显示顺序的最近日期第一。
到目前为止,这就是我所得到的:
SELECT
customer.cust_id,
customer.forename,
customer.surname,
products.prod_name,
sales.Date_of_sale
FROM customers c
INNER JOIN sales s ON c.cust_id = s.cust_id
INNER JOIN products p ON s.product_id = p.product_id
ORDER BY s.Date_of_sale DESC任何帮助都将不胜感激。
发布于 2014-10-17 15:16:48
这
SELECT
c.cust_id,
c.forename,
c.surname,
p.prod_name,
s.Date_of_sale
FROM customers c
INNER JOIN sales s ON c.cust_id = s.cust_id
INNER JOIN products p ON s.product_id = p.product_id
ORDER BY s.Date_of_sale DESC行得通
https://stackoverflow.com/questions/26428040
复制相似问题