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 get all unique years from a date column using Sql(Mysql)?
- How to get default value from input field in jquery?
- How to stop and pause youtue video in jquery?
- How to detect the current user has an active subscription in woocommerce?
- How to check if Order Contains Product ID in woocommerce (if product is buy)?