> SELECT R1.* from R1 left join R2 on (R1.id=R2.pid) where R2.id is NULL; > > The problem of such a statement is that the result set show me all the rows > from R1 which does not have ANY references in R2, and i would like to have > all rows from R1, which does not have any rows of a certain type in R2 > (lets say R2.type="D").
SELECT R1.* from R1 left join R2 on (R1.id=R2.pid) where R2.type != "D"; AFAIK 'null' != "D", so this should include rows without any references plus rows with a reference, but not of type="D". Regards, Jigal. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]