Special ORDER BY - Mailing list pgsql-general

From Martín Marqués
Subject Special ORDER BY
Date
Msg-id CABeG9LtRiaAaEULLwxBoud+xcv+HknpFYioUaQYkC2ynq_4t+Q@mail.gmail.com
Whole thread Raw
Responses Re: Special ORDER BY
Re: Special ORDER BY
List pgsql-general
How can I order a result set by a special order of a column. For
example, let's say I have this query


SELECT * FROM subcampo sc JOIN campo c ON (c.codigo = sc.campo)
      WHERE c.etiqueta IN (245, 130, 240, 243, 246, 490, 630, 730, 740)

Now I want to order the result set using c.etiqueta but with the order
of the values as you see in the IN clause.

How can I do that?

--
Martín Marqués
select 'martin.marques' || '@' || 'gmail.com'
DBA, Programador, Administrador

pgsql-general by date:

Previous
From: Edson Richter
Date:
Subject: Re: Feature discussion: Should syntax errors abort a transaction?
Next
From: Tulio
Date:
Subject: Re: Special ORDER BY