Re: [SQL] Selecting rows with "static" ordering

2007-04-27 Thread Kevin Hunter
At 8:01p -0400 on 26 Apr 2007, Steve Midgley wrote: From that application, I want to retrieve all those rows, and I want them in the order they are currently stored in that variable. So take for example this foreign application variable: ids = "3,2,5,1,4" The application then executes thi

Re: [SQL] Selecting rows with "static" ordering

2007-04-26 Thread Peter Childs
On 27/04/07, Aaron Bono <[EMAIL PROTECTED]> wrote: On 4/26/07, Steve Midgley <[EMAIL PROTECTED]> wrote: > So take > for example this foreign application variable: > >ids = "3,2,5,1,4" > > The application then executes this sql: > >select * from table where id in (3,2,5,1,4) > > As-is, of

Re: [SQL] Selecting rows with "static" ordering

2007-04-26 Thread Aaron Bono
On 4/26/07, Steve Midgley <[EMAIL PROTECTED]> wrote: So take for example this foreign application variable: ids = "3,2,5,1,4" The application then executes this sql: select * from table where id in (3,2,5,1,4) As-is, of course, the above query will return the 5 records in a semi-random

Re: [SQL] Selecting rows with "static" ordering

2007-04-26 Thread chester c young
> them in the order they are currently stored in that variable. So take > > for example this foreign application variable: > >ids = "3,2,5,1,4" kludgy, but: 1. store your ids in a pg array 2. select from the array 3. on order by, write a function that takes the row.id and array as paramet

Re: [SQL] Selecting rows with "static" ordering

2007-04-26 Thread Phillip Smith
] On Behalf Of Steve Midgley Sent: Friday, 27 April 2007 10:01 To: pgsql-sql@postgresql.org Subject: [SQL] Selecting rows with "static" ordering Hello, I have a strange problem (or one that I've never had before anyway). I am searching for a list of "id's" for a given table

[SQL] Selecting rows with "static" ordering

2007-04-26 Thread Steve Midgley
Hello, I have a strange problem (or one that I've never had before anyway). I am searching for a list of "id's" for a given table (these id values are generated at run-time and held statically in an application-local variable). From that application, I want to retrieve all those rows, and I