SQLTeam.com | Weblogs | Forums

Oredering Data in specific manner


Hi Everyone,

I have a requirement where from a View need to get result in a specific sorting order. Here is sample table-

Now the data has to arrange in Descending order based on the last day BASE_PERCENTAGE. So Last day is 04-Feb-2017 and the highest to lowest order is Jessie, Ricky, Jammie and Jasmine. The final output should arrange data based on BASE_PERCENTAGE, CURR_DATE and Name. Like This-

Could someone please help to how to get the same result using sql. How sql can be written to that it gives the same result.

Please let me know if you need more explanation.

Attached Table_View_sql.sql is having table create, Sample Data Insert and View creation. View will give the data with BASE_Percentage.




i belive ricky with BASE_PERCENTAGE = 18.8118 should be appear after jessie.

Please correct me if i am wrong.


Hi @nextaxtion, That's correct and Thank you for pointing out the mistake. I have corrected that in the question.


I doubt folk here will bother to look at that. Can you just Cut & Paste the SQL for the VIEW into a message here?

Please format it as follows:


    ... Your SQL here ...