0
Hello,
Could you help me with this question? I’m making a query
in MYSQL you need to search the records database and sort them by two different columns using ORDER BY
. I’m using the query
following, but does not function as expected.
SELECT * FROM customers ORDER BY status = 'Desenvolvimento', created DESC limit $inicio, $quantidade_pg "
For the column "status" I have two possible values, "Development" and "Completed". The idea was to sort the requests by "Development" and then sort them by the "created" column that has the creation date of the record in the database. Can you help me with the right path to this? I need to use subquery
for that kind of query
? Remember, I’m using this query
within a Javascript, so it has the codes in the start and quantity_pg variables.
The syntax
ORDER BY X = Y
does not exist. If you just want to sort by status, it’s justORDER BY status
; the part of the comparison,= 'Desenvolvimento'
, it’s hanging over and it doesn’t make sense there.– Woss