I have this query:
SELECT * FROM project as p inner join users as u on p.user_id = u.user_id
ORDER BY p.projectname, u.date_joined
Now what I want to ORDER by projectname ASC
and u.date_joined DESC
.
How could I make it this way? I tried this code here but doesn't work:
SELECT * FROM project as p inner join users as u on p.user_id = u.user_id
ORDER BY p.projectname ASC, u.date_joined DESC
Order the projectname ascending works but the descending won't work.
To order project name descending, do this:
SELECT *
FROM project p
INNER JOIN users u ON p.user_id = u.user_id
ORDER BY p.projectname DESC, u.date_joined DESC
This will order your result by projectname desc (Z to A) first. For identical projectname records, date_joined will be used for sorting further (latest date first).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.