V samotném SQL to můžete udělat pomocí UNION
. A použijte ORDER BY
za celý dotaz!
SELECT `title1` AS `title`, `type`
FROM `table`
UNION
SELECT `title2` AS `title`, `type`
FROM `table`
ORDER BY `title` ASC
Výstup
+-------+------+
| TITLE | TYPE |
+-------+------+
| asd1 | 7 |
| asd2 | 7 |
| qwe1 | 3 |
| qwe2 | 3 |
+-------+------+