SQLTeam.com | Weblogs | Forums

Oredering Data in specific manner


#1

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.

http://www.filedropper.com/tableviewsql

Thanks,
Anupam


#2

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

Please correct me if i am wrong.


#3

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


#4

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:

 ```sql

    ... Your SQL here ...