为什么下面的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
答案 0 :(得分:8)
您已在customer
声明中列出了FROM
两次表格。这是固定版本:
SELECT customer.id, customer.firstName, account.id
FROM account
INNER JOIN customer
ON customer.id = account.customerId
ORDER BY customer.id