I am actually coding a php script and I want to return all the values that doesn't have a relation between two tables.
Basically I have two tables, one is called users, the other one is called agents, the structure of the users table is the following:
ID (auto_increment) | username (email address) | password
the structure of the agents table is the following
ID (auto_increment) | EmailAddress | city | state | country
with
Expand|Select|Wrap|Line Numbers
- SELECT * FROM dbname.users AS users, dbname.agents AS agents WHERE agents.EmailAddress = users.username
But my goal is to display the results that doesn't match, so I tried to do:
Expand|Select|Wrap|Line Numbers
- SELECT * FROM dbname.users AS users, dbname.agents AS agents WHERE agents.EmailAddress != users.username
There is something wrong in my query, but where?
thanks in advance