Order by parts of a field

wxdqz

New Member
I have some fields on my database, like:

username flags
foo abc
bar ac
foobar b
barfoo c

And I'd like to perform a SQL query sorted by the chars in the flags-field. First I'd like to get all with 'a' in it, and then all with 'c', so it's not even alphabetic order and I don't want to sort by all chars. The 2nd order should be username.

A good output would be:

bar ac
foo abc
barfoo c
foobar b

Is it possible to do this in one SQL query?
Thanks in advance.
 
Back
Top