user3092953 user3092953 - 1 year ago 71
SQL Question

Select from table where doesn't appear in another table PHP

I have 2 tables, one called

(tbl1) and another called
(tbl2). I want to display all rows from tbl1 that dont appear in tbl2.

So far, from looking i've found the below code, however it doesnt seem to be working as I currently see all rows from the DB.

$result11=mysql_query("SELECT * FROM system_dashboard_stats WHERE id NOT IN (SELECT id FROM user_dashboard_stats)")or die('Error' . mysql_error());

Answer Source

SELECT * FROM system_dashboard_stats LEFT JOIN user_dashboard_stats ON = WHERE IS NULL;

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download