Roger,

Thank you for the feedback. But unfortunately this doesn't work. The problem is that rid will never be null. I'm trying to find the item in tab1 where a link cannot be created in tab2 where tab2.rid=tab1.id and tab2.vid=46 because there is no record in tab2. Not that the record may have null values. I did try what you said and it didn't work.

But thanks,

Joe

On Friday, January 16, 2004, at 11:49 AM, Roger Baklund wrote:

* sulewski
[...]
What I need is all records in table 1 that will
not link to table 2 such that relid=rid and vid=46

Sounds like a job for LEFT JOIN...?


Join to the rows you do NOT want with a left join, and put as a condition in
the WHERE clause that a joined column IS NULL. Something like this:


SELECT tab1.*
  FROM tab1
  LEFT JOIN tab2 ON
    tab2.rid=tab1.id AND
    tab2.vid=46
  WHERE
    tab2.rid IS NULL

--
Roger



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to