Skip to content
Advertisement

Sql query to fetch most recent record upto 10 and order by filed where row rank is mentioned [closed]

Following is my table in Mysql. I want to fetch record of latest date in field “rank_date” and display result by order 1 to 10 based on order # in filed “drama_rank”

enter image description here

Advertisement

Answer

You can filter with a subquery, then order by:

JavaScript

Alternatively, assuming MySQL 8.0, you can use window functions:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement