var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Order By
I'm trying to figure out how to order data so rows which begin in a certain sequence are returned first, followed by the rest of the data in ascending order.
how would i structure the ORDER BY clause so it came out like:
I'm sure if its possible you would use the wild card some how just not sure of the correct syntax!
order by case when name like 'xy.%' then 1 else 2 end, name
Thanks for that. Would like to look into the numbering part further (...1 else 2...) - is there a phrase associated with it so i can look it up?
it's a simple logical construction
Originally Posted by mattock
the CASE expression tests for something on each row, and if it's true, it assigns the value 1 to a pseudo-column for that row, otherwise it assigns 2
the solution works because 1 comes ahead of 2 if you sort on those values
for additional examples, search on the phrase "custom sort order"