sort on column type enum

Hi all

I have a column of type enum('A', 'AP', 'CR', 'D', 'DL', 'H', 'HD',
'HH', 'R', 'S', 'PL'). i want to sort the result by 'DL', 'H','A',and
the rest .

Thanks in advance
iavian [ Di, 26 September 2006 16:56 ] [ ID #1478867 ]

Re: sort on column type enum

SELECT * FROM table ORDER BY enumcol IN ('DL','H','A'), enumcol;

See Imran Chaudhry's post at
http://dev.mysql.com/doc/refman/5.1/en/select.html

vjyanand [at] gmail.com wrote:
> Hi all
>
> I have a column of type enum('A', 'AP', 'CR', 'D', 'DL', 'H', 'HD',
> 'HH', 'R', 'S', 'PL'). i want to sort the result by 'DL', 'H','A',and
> the rest .
>
> Thanks in advance
peterloh [ Di, 03 Oktober 2006 03:40 ] [ ID #1487001 ]
Datenbanken » mailing.database.mysql » sort on column type enum

Vorheriges Thema: Mysql Vs. Postgresql
Nächstes Thema: SETting a datetime field based on a text field