Why does this SQL code give error 1066 (Not a unique table / alias: "client")?

Why does the MySQL query below give error 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
source share
1 answer

You have specified the customer table twice in your FROM expression. Here's the fixed version:

 SELECT customer.id, customer.firstName, account.id FROM account INNER JOIN customer ON customer.id = account.customerId ORDER BY customer.id 
+8
source

Source: https://habr.com/ru/post/1305162/


All Articles