sort on column type enum

sort on column type enum

am 26.09.2006 16:56:20 von iavian

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

Re: sort on column type enum

am 03.10.2006 03:40:14 von peterloh

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@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