We figured out that there was a very poor code written in one of the Stored Procedure’s Order By clause. Let us learn today how to order by a parameter.
The question was about Group By Orders Data by Columns Ascending. DBA asked me an interesting question referring to my older blog.
Question: How to Sort a Varchar Column Storing Integers with Order By?
CONVERT function can be used to change the format of DATE to various formats like MM/dd/yyy, dd/MM/yyy, yyy/MM/dd, etc. But have you ever noticed that this will produce resultset with a different order if the alias name is used in ORDER BY Clause? Well, I just learned about the formatted date from my recent consulting engagement Comprehensive Database Performance Health Check.
Once in a while, I get questions where users have indeed explained the question well enough that I can easily understand their question. If I understand question quickly, I am always able to answer it efficiently as well. In this blog post, we will see one such question which I answered with keywords WITH OVER and PARTITION BY.
Question: How Does TOP WITH TIES Work in SQL Server?
Answer: This is an ancient question I just encountered in the recent Comprehensive Database Performance Health Check.
Question: How to Keep Certain Records on Top While Ordering Data?