Posts

Showing posts with the label learning

Custom order for SQL Query results using Order By

One thing that I surely believe is "Necessities drive Innovation". But, one has to think different at crucial times to be innovative. Well, that's not a subject of discussion for this. But it does originate from that idea. Just before our monthly release and when everything is all prepared, we found a bug in the code. GOD, how many times we test, where do they make their way. Anyways, we needed something which required no code changes as the code is already delivered. We only had database with us to play. Basically our problem was, we needed the first record from the set of two records based on a values in VARCHAR field. That means, we needed to apply some ordering to the records based on the values. But, ORDER BY only supports Alphabetic ordering on the values. But, that's what we generally know. Because we wanted to order the records in the manner we specify, we had to look for some solution. And we did find an interesting stuff at Jmatrix.net that allows us to s...