Below is the standard query that sort weight in descending order.
SELECT * FROM article ORDER BY weight DESC LIMIT 0, 4 +-------------+--------+ | title | weight | +-------------+--------+ | B | 2 | | E | 2 | | Y | 2 | | A | 1 | | C | 1 | | D | 1 | | F | 1 | | G | 1 | | X | 1 | | Z | 1 | | I | 1 | | G | 1 | +-------------+--------+
However, I wish to sort it differently as following based on the weight value.
+-------------+--------+ | title | weight | +-------------+--------+ | B | 2 | | A | 1 | | C | 1 | | D | 1 | | E | 2 | | F | 1 | | G | 1 | | X | 1 | | Y | 2 | | Z | 1 | | I | 1 | | G | 1 | +-------------+--------+
The record with weight value 2 only selected once and sorted at the top. Then followed by records with weight value 1.