Re: where clauses and multiple tables

From: miller_2555 <nabble(dot)30(dot)miller_2555(at)spamgourmet(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: where clauses and multiple tables
Date: 2009-09-08 23:03:08
Message-ID: 25355681.post@talk.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Scott Frankel-3 wrote:
>
> Is it possible to join tables in the where clause of a statement
>
> I've explored the "where exists" clause, but that's not supported by
> the application toolkit I'm using. AFAIK, I've only got access to
> where ...
>
> Thanks in advance!
> Scott
>

Not entirely sure of the objective, but perhaps an inner join is the topic
for which you are looking? Else, I'd suggest one of the following formats
(which may, or may not, be available to you).

SELECT foo.* FROM (SELECT * FROM bar WHERE bar."bar_id"='value') AS foo
WHERE ....
SELECT foo.* FROM foo WHERE foo."bar_id" IN (SELECT bar."bar_id" FROM bar
WHERE ...);
SELECT foo.* FROM foo WHERE foo."bar_id" IN (SELECT bar."bar_id"
FROM(SELECT ....) AS bar WHERE ...);

--
View this message in context: http://www.nabble.com/where-clauses-and-multiple-tables-tp25355350p25355681.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message miller_2555 2009-09-08 23:10:06 Re: Transaction Strategies for Natural Primary Keys & Cascading Updates
Previous Message David W Noon 2009-09-08 23:02:21 Re: where clauses and multiple tables