MySql Error #1066: Not unique table/alias: '%s'
In a MySql query, if a table name or an alias is not unique you will get the following error:
MySql Error #1066: Not unique table/alias: '%s'
The following query is not correct and will throw an error:
SELECT *
FROM yourtable, yourtable
WHERE ...
here we are joining yourtable with itself, but the same table name is used twice. We need to give every table a distinct alias:
SELECT *
FROM yourtable AS a, yourtable AS b
WHERE ...
The same error could be thrown if the same alias is used twice:
SELECT *
FROM table1 AS a, table2 AS a
WHERE ...