Select id FROM calen WHERE id >= '3'
Select id FROM calen WHERE id < '3'
Выводит 3 4 5 6 1 2
Можно ли вывести такой результат одним запросом?
order by field - не подойдёт
Вот это не подойдет ?
MySQL 5.5.32 Schema Setup:
create VIEW `generator_16` AS select 0 AS `n` union all select 1 AS `1` union all select 2 AS `2` union all select 3 AS `3` union all select 4 AS `4` union all select 5 AS `5` union all select 6 AS `6` union all select 7 AS `7` union all select 8 AS `8` union all select 9 AS `9` union all select 10 AS `10` union all select 11 AS `11` union all select 12 AS `12` union all select 13 AS `13` union all select 14 AS `14` union all select 15 AS `15`;
Query 1:
select n from generator_16 order by n<3,n
| N |
|----|
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |
| 9 |
| 10 |
| 11 |
| 12 |
| 13 |
| 14 |
| 15 |
| 0 |
| 1 |
| 2 |
работает потому-что для 0,1,2 n<3 === 1 иначе 0