i want my query to return a specific row of the table where a column contains specific value first and with year desc.
if i have table something like this
Table employee
id - Name - Year - Status
1 - Ashish - 2016 - Old
2 - Srisan - 2017 - New
3 - Mohit - 2018 - New
4 - Ram - 2015 - Old
5 - Boby - 2016 - New
then result should be
id - Name - Year - Status
3 - Mohit - 2018 - New
2 - Srisan - 2017 - New
5 - Boby - 2016 - New
1 - Ashish - 2016 - Old
4 - Ram - 2015 - Old
Where Status is new and sort via desc of Year
3
Answers
You can try below –
Sort by
FIELD(Status)
andYear
For expected result as mentioned in your question, query would be
it has all rows but if you want specific rows then you have to use Where clause as mentioned below as per your required condition.