Sorting in descending order in SQL
The ORDER BY statement in sql is used to sort the fetched data in either ascending or descending according to one or more columns.
- By default ORDER BY sorts the data in ascending order.
- We can use the keyword DESC to sort the data in descending order and the keyword ASC to sort in ascending order.
“select * from $dealtable where user_id=’$uid’ AND status=’$status’ ORDER BY ID DESC”
“select * from $dealtable where user_id=’$uid’ AND status=’$status’ ORDER BY ID ASC”
Read More Posts
- How to add custom social share button in wordpress without plugin?
- How to redirect user on different page accounding to user (Customer, editor, admin, subscriber and etc) on wordpress dashboard?
- How to get timstamp from time in php?
- How to delete data from database in wordpress?
- How to use WP_Query with have_posts()?