5

为什么下面的 MySQL 查询会出错1066 (Not unique table/alias: 'customer')

SELECT customer.id, customer.firstName, account.id
FROM customer, account
INNER JOIN customer
ON customer.id = account.customerId 
ORDER BY customer.id
4

1 回答 1

9

您在声明中customer 两次列出了该表FROM。这是固定版本:

SELECT customer.id, customer.firstName, account.id
FROM account
INNER JOIN customer
ON customer.id = account.customerId
ORDER BY customer.id
于 2010-03-25T22:19:54.230 回答