Answer the question
In order to leave comments, you need to log in
How to get all fields from the database?
Let's say we have an articles table. It has fields id, name, description, category, etc.
How to get all the fields from the database, but so that the fields with category=1 and category=3 are first, and then all the rest?
Answer the question
In order to leave comments, you need to log in
SELECT * FROM articles ORDER BY FIELD(category, 3, 1) DESC;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question