Re: [GENERAL] selecting data from subquery in same order

2008-08-17 Thread Dmitry Koterov
You may use something like this in a stored function: DECLARE a INTEGER[]; BEGIN a := '{2341548, 2325251, 2333130, 2015421,2073536, 2252374, 2273219, 2350850, 2367318, 2032977, 2032849}'; select * from users where id = any(a) order by idx(a, id); END; Or in the plain SQL: select

Re: [GENERAL] selecting data from subquery in same order

2008-08-16 Thread Scott Marlowe
On Sat, Aug 16, 2008 at 8:07 PM, Scott Marlowe <[EMAIL PROTECTED]> wrote: > On Sat, Aug 16, 2008 at 6:11 PM, mark <[EMAIL PROTECTED]> wrote: >> hi >> if i execute this statement: >> >> select * from users where id in (2341548, 2325251, 2333130, 2015421, >> 2073536, 2252374, 2273219, 2350850, 236731

Re: [GENERAL] selecting data from subquery in same order

2008-08-16 Thread Scott Marlowe
On Sat, Aug 16, 2008 at 6:11 PM, mark <[EMAIL PROTECTED]> wrote: > hi > if i execute this statement: > > select * from users where id in (2341548, 2325251, 2333130, 2015421, > 2073536, 2252374, 2273219, 2350850, 2367318, 2032977, 2032849, ) > > the order of rows obtained is random. > > is there any

[GENERAL] selecting data from subquery in same order

2008-08-16 Thread mark
hi if i execute this statement: select * from users where id in (2341548, 2325251, 2333130, 2015421, 2073536, 2252374, 2273219, 2350850, 2367318, 2032977, 2032849, ) the order of rows obtained is random. is there anyway i can get the rows in the same order as the ids in subquery? or is there a d