Re: JOIN on set of rows?

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: JOIN on set of rows?
Дата
Msg-id 4281B2BA.7070801@archonet.com
обсуждение исходный текст
Ответ на JOIN on set of rows?  (Peter Fein <pfein@pobox.com>)
Ответы Re: JOIN on set of rows?  (Peter Fein <pfein@pobox.com>)
Список pgsql-general
Peter Fein wrote:
> Hiya-
>
> I need to do something like this:
>
> SELECT t1.symbol AS app_name, t2.outside_key AS app_id
> FROM t2 LEFT JOIN t1 ON t1.t2_id=t2.id AS my_join
> LEFT JOIN rows of arbitrary (app_name, app_id) ON
> my_join.app_name=rows.app_name AND my_join.app_id=rows.app_id
>
> The arbitrary app_name, app_id come from my app ;). I can't figure out
> how to create something that acts like a table with rows specified in
> the text of the query.
>
> A temporary table perhaps?  I don't know much (anything) about these...

OK - a few points.

1. I don't see any of your arbitrary columns used in the output of this
query, which since they are on the outside of a left join means they
don't have any effect. I'm assuming that's not what you want.
2. If the values are truly arbitrary, you might as well just generate
random text and numbers in the query itself. So - are they user supplied
values, or selections from a large set of possible values.
3. You don't say how many rows - 10, 100, 1000, 1 million?

--
   Richard Huxton
   Archonet Ltd

В списке pgsql-general по дате отправления:

Предыдущее
От: "Dinesh Pandey"
Дата:
Сообщение: Re: database export in pgsql
Следующее
От: "Zlatko Matic"
Дата:
Сообщение: lazarus/zeos - installation ?