[GENERAL] Is it possible to make the order of output the same as the order of input parameters?

2010-06-02 Thread m. hvostinski
Hi, I have a simple query like: SELECT * FROM customer WHERE id IN (23, 56, 2, 12, 10) The problem is that I need to retrieve the rows in the same order as the set of ids provided in the select statement. Can it be done? Thanks

Re: [GENERAL] Is it possible to make the order of output the same as the order of input parameters?

2010-06-02 Thread m. hvostinski
(':' || id || ':' IN ':23:56:2:12:10:'); == Approach 4 == WITH t(a) AS (VALUES (ARRAY[23, 56, 2, 12, 10])), s(i) AS (SELECT generate_subscripts((SELECT a FROM t)::integer[], 1)) SELECT i, a[i] FROM s CROSS JOIN t; On Wed, Jun 2, 2010 at 7:43 AM, Stephen Frost wr

[GENERAL] Clarification regarding array columns usage?

2009-12-25 Thread m. hvostinski
Hi, I would appreciate if someone could clarify the aspects of using array columns. We need to store up to ten related integer values per row and currently it is implemented as a varchar column that holds a string that is concatenated by a trigger function. Something like this: FOR var IN (SELEC