0

I am trying to order my table by date order but only shows the information by ID and does seems to ignore everything after ORDER BY.

I have tried using ID="ASC" and Date="DESC" and other variations from the table but still displays it the same way.

SELECT * FROM task_activity where user_id = ? order by id="DESC", date="DESC"

Table Structure:

id
userid
hour
activity
date

Any advise please?

Dharman
  • 26,923
  • 21
  • 73
  • 125
SirDongle
  • 17
  • 2
  • You are sorting by the expression id="DESC" which is going to always be false, since id won't equal that string. Since it is false for all rows, you are effectively not sorting at all. You mean to be saying `ORDER BY id DESC, date DESC` – ysth Oct 22 '21 at 22:45

0 Answers0