ryel01 Posted January 17, 2011 Share Posted January 17, 2011 hello! does anyone know how to structure an sql statement to order selected results by category name (catname) alphabetically, but any starting with "other%" always appear last? regan Link to comment https://forums.phpfreaks.com/topic/224667-order-by-category-name-but-other-is-always-last/ Share on other sites More sharing options...
trq Posted January 17, 2011 Share Posted January 17, 2011 You would need to use two separate queries. Link to comment https://forums.phpfreaks.com/topic/224667-order-by-category-name-but-other-is-always-last/#findComment-1160519 Share on other sites More sharing options...
ryel01 Posted January 17, 2011 Author Share Posted January 17, 2011 This seems to work... order by name like "Other%" asc ,name not like "Other%" asc Link to comment https://forums.phpfreaks.com/topic/224667-order-by-category-name-but-other-is-always-last/#findComment-1160972 Share on other sites More sharing options...
ryel01 Posted January 17, 2011 Author Share Posted January 17, 2011 This seems to work... order by name like "Other%" asc ,name not like "Other%" asc Actually no, that didn't work. But this does... order by case when lower(cat_name) like 'other%' then 'zzzzz' else cat_name end Link to comment https://forums.phpfreaks.com/topic/224667-order-by-category-name-but-other-is-always-last/#findComment-1161008 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.