I Have two tables...
TABLE1
Usernames | Passwords Joe | flgjdlsfkgj John | dfsgasdfg Mike | 2342342
TABLE 2
Usernames | Vote Option Joe | 2 John | 3
How can use table 1 to tell me who has not voted in table 2??
Thanks
SELECT * FROM TABLE1 t1 LEFT JOIN TABLE2 t2 ON t1.usernames=t2.usernames WHERE t2.usernames IS NULL
Can you please explain this, I can't see to get it to work.....
See mySQL manual
If there is no matching row for the right table in the ON or USING part in a LEFT JOIN, a row with all columns set to NULL is used for the right table. You can use this fact to find rows in a table that have no counterpart in another table: SELECT table1.* FROM table1 LEFT JOIN table2 ON table1.id=table2.id WHERE table2.id IS NULL; This example finds all rows in table1 with an id value that is not present in table2 (that is, all rows in table1 with no corresponding row in table2). This assumes that table2.id is declared NOT NULL.
If there is no matching row for the right table in the ON or USING part in a LEFT JOIN, a row with all columns set to NULL is used for the right table. You can use this fact to find rows in a table that have no counterpart in another table:
SELECT table1.* FROM table1 LEFT JOIN table2 ON table1.id=table2.id WHERE table2.id IS NULL;
This example finds all rows in table1 with an id value that is not present in table2 (that is, all rows in table1 with no corresponding row in table2). This assumes that table2.id is declared NOT NULL.