SELECT name, group_name FROM template
WHERE (name IN ('header','footer','main'))
AND (group_name='fantasy' OR group_name='')
ORDER BY group_name DESC,name DESC LIMIT 0,3;
| name | group_name |
| header | fantasy |
| footer | fantasy |
| main | |
ps... welcome to dBforums
by the way, I reformatted your post coz you totally ballsed up my display!
Arrr... i worked it out, i thought this is what you had done but the DESC tricked me.
The reason it worked here is because it happens that the one that i wanted to appear 3rd happens to be the last in the alphabet of the 3. This might not always be the case, it is just a co-incidence. It might be that the header is the one with only header | and that needs to appear 3rd, so basically it was a quirk
I think a code solution is the best way, and i have found one so am happy cheers though, am learning a lot of SQL as i muck along here!