How to ordering results by specific field values in MySQL.
HTML-код
- Опубликовано: 5 сен 2024
- How to ordering results by specific field values in MySQL.
-------------------------------------------------------------------------------------------
Generally we can ordering the results either Ascending / Descending.
But we can order by our own order also i,e custom order.
Here i taken the two tables
1) roles
2) users
roles table having some the roles names these are mapped in the users table.
Now i want to join these two tables
Now i will apply the general Asc and Desc orders
in Asc order the data will display 1,2,3,4,5
in Desc order the data will display 5,4,3,2,1
But i want to display the data in my own order i.e 3,2,4,1,5
For that we need to use the Field() function.
Thanks it works great
Thanks
Thanks a lot ...@techiesbadi for uploading this query solution