From: | Kief Morris <k(dot)morris(at)bitbull(dot)com> |
---|---|
To: | "'Peter Eisentraut'" <peter_e(at)gmx(dot)net> |
Cc: | "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org> |
Subject: | RE: [SQL] Returning multiple rows in functions |
Date: | 2000-03-06 17:16:51 |
Message-ID: | 30C64922AF42D311A96D00A0C91D0B107EB551@mailpost.syzygy.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
> > ... but it only returns the first matching row. Is there
> > a way to return all the matching rows?
>
> No. Perhaps making a view would fit your application.
Looking over the docs for views, it doesn't seem like it
will work - I would need to create a new view for each
request, since the WHERE clause of the query changes
depending on the user.
My query is actually a bit more complex than the example
I provided, I'm trying to do the following:
SELECT id FROM mytable WHERE
( value_id = 1 AND value < $1 + 1 AND value > $1 - 1 ) OR
( value_id = 2 AND value < $6 + 1 AND value > $6 - 1 ) OR
( value_id = 3 AND value < $7 + 1 AND value > $7 - 1 );
... and actually, I need to have about 10 of those clauses
in the WHERE clause of the statement. This is insanely
inefficient, there's got to be a smarter way to do this.
From | Date | Subject | |
---|---|---|---|
Next Message | Ross J. Reedstrom | 2000-03-06 18:02:22 | Re: [SQL] index file's growing big |
Previous Message | Karl Denninger | 2000-03-06 16:46:19 | Re: [SQL] index file's growing big |