Wypróbuj ten -
SELECT * FROM table_name
ORDER BY
IF(FIELD(status, 1,2,3), date_added, '9999-12-31') ASC,
IF(FIELD(status, 4,5), end_date, NULL) DESC;
Wypróbuj ten -
SELECT * FROM table_name
ORDER BY
IF(FIELD(status, 1,2,3), date_added, '9999-12-31') ASC,
IF(FIELD(status, 4,5), end_date, NULL) DESC;