SQL:使用外键选择多个表时出现问题

时间:2019-09-22 08:14:38

标签: mysql

问题

我也不完全是我想要的。

要发生的目标

我想为我的数据库创建一个事务视图,输出将是:

表格

客户表
enter image description here

员工表
Employee Table

产品表
Product Table

交易表
Transaction Table

交易表
[Transaction Table]

我想发生的结构:

Click here to view

我的SQL查询:

SELECT
  customer.CustomerName,
  transactions.TransactionID,
  transactions.Date,
  transactions.Type,
  transactions.Method,
  product.ProductName,
  product.Quantity,
  product.Price,
  employee.EmployeeName
FROM
  customer,
  transactions,
  product,
  employee
WHERE
   customer.CustomerID = transactions.TransactionID

查询输出:

Click here to view

0 个答案:

没有答案