Re: Stored Procedure Assistance
От
Michael Pohl
Тема
Re: Stored Procedure Assistance
Дата
Msg-id
Pine.LNX.4.44.0307081323510.28045-100000@server1.techplant.com
Ответ на
Stored Procedure Assistance (Bradley J. Bartram)
Список
Дерево обсуждения
Stored Procedure Assistance "Bradley J. Bartram" <bbartram@dyrectmedia.com>
Re: Stored Procedure Assistance Alvaro Herrera <alvherre@dcc.uchile.cl>
Re: Stored Procedure Assistance Richard Huxton <dev@archonet.com>
Re: Stored Procedure Assistance Michael Pohl <pgsql@newtopia.com>
On Tue, 8 Jul 2003, Bradley J. Bartram wrote: > The first query is simple: > > SELECT a FROM table_a WHERE column_a = b > > This will return a single row. The next query takes that derived value and > does a simliar select that returns multiple rows. > > SELECT c FROM table_b WHERE column_b = a > > The next query has some logic in php that constructs it. Basically if c > 0 > than the results of query 2 are setup as ORs in the WHERE clause. > > SELECT d FROM table_c WHERE column_c = c1 OR column_c = c2, etc. > > The first two queries are not a problem, but how can I take the array of > results from query 2 and put them into query 3? Are you sure you need plpgsql to get from point a to point d? It looks like this could be a single query: select d from table_c where column_c in (select c from table_a, table_b where table_a.column_a = b and table_b.column_b = table_a.a) michael
В списке pgsql-general по дате отправления