Ever since I moved to a different company in 2008 this blog has accumulated some dust. Moving away from scientific programming into a more traditional web programming world made it more difficult for me to stay in touch with the exciting world of scientific research, algorithms and so on. From 2010 onwards, I had the […]
Consider the following scenario: the business analyst of your company sends you a business requirement in which the text results of a given query must be ordered arbitrarily according to the specifics of that business requirement. For example: Us should precede Cs, which should precede Uns, which should precede Bs, which should precede everything else. It can be very costly to resort to manipulations of the result set after the query has been executed, while a stored procedure is not very portable. You can make the query itself return the results in the arbitrary order you wish by modifying the select statement in such a way that your arbitrary order will output a number (or any other orderable output) that can be used as an order by condition.