If you want it in a given order, ask for it in a given order...

Why is this concept so difficult for people to grasp? If you want SQL to return your results in a given order (on any platform) you must, must, I repeat... MUST, ask for it in that order!

I don't care if it has "always" come back in last-name order when you ran this query. If you didn't specify an order-by then SQL is free to give it back in some other order if it feels so inclined.

There are few absolutes in the world, you don't use your hands in soccer, servers are sure to fail on a Friday afternoon, and if you want your result set ordered a specific way, ASK for it!

2 comments: