Re: Quetions on Joins
| От | Stephan Szabo |
|---|---|
| Тема | Re: Quetions on Joins |
| Дата | |
| Msg-id | 20030831111037.K94333-100000@megazone.bigpanda.com обсуждение исходный текст |
| Ответ на | Quetions on Joins (Alex <alex@meerkatsoft.com>) |
| Список | pgsql-general |
On Mon, 1 Sep 2003, Alex wrote: > Hi, > > I have a query where I want to filter out records from table_a if a > field in table_a matches in table table_b. Basically table_b defines the > filter. Well something like one of the following should work depending on how you want to treat nulls and such (and performance varies in postgresql by version for each of the options): SELECT a.value_one FROM table_a AS A where NOT EXISTS (select 1 from table_b AS B WHERE A.value_two=B.value_two); SELECT a.value_one FROM table_a AS A where A.value_two NOT IN (select value_two from table_b); SELECT a.value_one FROM table_a AS A LEFT OUTER JOIN table_b AS B ON (a.value_two=B.value_two) WHERE B.value_two IS NULL;
В списке pgsql-general по дате отправления: