Search Postgresql Archives

where clause question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Hello,

Is it possible to perform selects in a where clause of a statement?

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';

I'm looking for a way to recast it so that the select and from clauses refer to a single table and the join referencing the second table occurs in the where clause. For example, something like this:

   SELECT foo.foo_id, foo.name
   FROM foo
   WHERE (SELECT * FROM foo, bar WHERE ...)
   foo.bar_id = bar.bar_id
   AND bar.name = 'martini';

I've explored the "where exists" clause, but it's not supported by the application toolkit I'm using. AFAIK, I've only got access to where ...

Thanks in advance!
Scott


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux