Re: bulduing a select to get excluded datas

From: Art Kagel via DBMonster.com <forum_at_DBMonster.com>
Date: Wed, 06 Apr 2005 14:12:06 GMT
Message-ID: <9c3ab7b3c2d1450ba49a38f9f31ec236_at_DBMonster.com>


What you need, if your server supports is, is an OUTER JOIN. There are various server specific and older syntaxes, but the SQL-92 syntax is:

select users.map_id,users_list.rank
from users_list
left outer join users

   on users.map_id = users_list.map_id
where

   users.map_id IS NULL;

The outer join will join any rows of the left table which have no match in the right or outer table to a NULL row. The join condition must be included in an ON clause as the where filtering is performed post-join. The test for the NULL valued column from the outer table must be included in a where clause to filter out those rows that found a match.

Art S. Kagel

-- 
Message posted via http://www.dbmonster.com
Received on Wed Apr 06 2005 - 16:12:06 CEST

Original text of this message