I am trying to join 2 tables but i got an error
'not unique table/alias: 'ct'
query is
select em.* ,ct.Cities_NAME
from Customer em,
Cities ct inner join Cities ct on ct.Cities_ID = em.Customer_CITY
where Customer_GROUP is NULL and Customer_ENABLED is not FALSE and Customer_TYPE != 'User'
where is the mistake and why?
Never use commas in the FROM
clause. Always use proper, explicit, standard JOIN
syntax:
select em.*, ct.Cities_NAME
from Customer em inner join
Cities ct
on ct.Cities_ID = em.Customer_CITY
where em.Customer_GROUP is NULL and
em.Customer_ENABLED and
em.Customer_TYPE <> 'User';
For some reason, you have listed ct
twice in the query. You should also qualify all column references in the query.