Re: How to make a IN without a table... ?

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: How to make a IN without a table... ?
Дата
Msg-id 20030612114933.GA1285@wolff.to
обсуждение исходный текст
Ответ на How to make a IN without a table... ?  (David Pradier <dpradier@apartia.fr>)
Список pgsql-sql
On Thu, Jun 12, 2003 at 11:19:14 +0200, David Pradier <dpradier@apartia.fr> wrote:
> 
> In short, i want to calculate the result of the function my_function for
> some values of my_var1, cross by some values of my_var2.
> These values are not taken in a table, but put in directly.
> They are a lot, so i would prefer not to write the whole thing, line
> after line. (Let's say 10 values for the first, and 40 for the second =>
> 400 lines of code to maintain...)

If there aren't a huge number of values you can use union. (If there
are a large number then you probably want to load temp tables using
copy.) For example:
select myval1, myval2, f(myval1,myval2) from   (select '1' union select '2' union select '3') as tab1 (myval1),
(select'1' union select '2' union select '3') as tab2 (myval2);
 


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

Предыдущее
От: Achilleus Mantzios
Дата:
Сообщение: Re: (no subject)
Следующее
От: David Pradier
Дата:
Сообщение: Re: How to make a IN without a table... ?