| From: | Scott Frankel <frankel(at)circlesfx(dot)com> | 
|---|---|
| To: | David W Noon <dwnoon(at)ntlworld(dot)com> | 
| Cc: | pgsql-general(at)postgresql(dot)org | 
| Subject: | Re: where clauses and multiple tables | 
| Date: | 2009-09-09 00:23:10 | 
| Message-ID: | F1D2C116-5D79-42AC-BD40-4431439B9D21@circlesfx.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
On Sep 8, 2009, at 4:02 PM, David W Noon wrote:
> On Tue, 8 Sep 2009 14:25:20 -0700, Scott Frankel wrote about [GENERAL]
> where clauses and multiple tables:
>
>> Is it possible to join tables in the where clause of a statement?
> [snip]
>> Given a statement as follows:
>>
>>  SELECT foo.foo_id, foo.name
>>  FROM foo, bar
>>  WHERE foo.bar_id = bar.bar_id
>>  AND bar.name = 'martini';
>
> Just use an IN predicate:
>
> SELECT foo_id, name FROM foo
> WHERE bar_id IN (SELECT bar_id FROM bar WHERE name = 'martini');
>
> This is frequently called a semi-join.
This looks very promising.  Thanks for the info!
Scott
> -- 
> Regards,
>
> Dave  [RLU #314465]
> =
> ======================================================================
> david(dot)w(dot)noon(at)ntlworld(dot)com (David W Noon)
> =
> ======================================================================
>
> -- 
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
Scott Frankel
President
Circle-S Studios
www.circlesfx.com
510-339-7477 (o)
510-332-2990 (c)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | John R Pierce | 2009-09-09 00:43:53 | Re: Can I Save images in postgres? | 
| Previous Message | 纪晓曦 | 2009-09-09 00:16:08 | Can I Save images in postgres? |