Jump to content

Archived

This topic is now archived and is closed to further replies.

redneonrt

Query Help please.

Recommended Posts

I have two MySql tables and I would like a query that selects everything from table 1 but only if the table1.id from table 1 does not exist in table2.id.

Any suggestions?

Share this post


Link to post
Share on other sites
use left join

[code]$sql = "SELECT fieldname
        FROM table1
        LEFT JOIN table2 ON table1_id = table2_id
        WHERE table2_id IS NULL";[/code]

Ray

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.