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

From: David Pradier <dpradier(at)apartia(dot)fr>
To: pgsql-sql(at)postgresql(dot)org
Subject: How to make a IN without a table... ?
Date: 2003-06-12 09:19:14
Message-ID: 20030612091914.GA680@apartia.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi everybody,

i ran today in a problem when doing some (i mean too much for me) advanced sql...

What i want to do is something like this:

SELECT
my_var1,
my_var2,
my_function(my_var1, my_var2)
FROM (
SELECT
'1',
'2',
'3',
'4'
) AS my_var1_values,
(
SELECT
'1',
'2',
'3',
'4'
) AS my_var2_values

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...)

I really don't see how to do this :-/

Any help is heartfully welcome,
David
--
dpradier(at)apartia(dot)fr 01.46.47.21.33

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Cedar Cox 2003-06-12 10:20:54 subselects - which is faster?
Previous Message Guy Fraser 2003-06-11 17:01:06 Re: Creating Views with Column Names based on Distinct