By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
create table t(id int not null primary key, epos int, array json)
insert into t values
(1, 2, json_array(2, 4)),
(2, 3, json_array(10)),
(3, 1, json_array(2, 3, 4)),
(4, 4, json_array(10, 11))
select *, cast(array as char)
from t
order by array
id | epos | array | cast(array as char) |
---|---|---|---|
2 | 3 | 5b31305d | [10] |
1 | 2 | 5b322c20345d | [2, 4] |
4 | 4 | 5b31302c2031315d | [10, 11] |
3 | 1 | 5b322c20332c20345d | [2, 3, 4] |
show warnings
Level | Code | Message |
---|---|---|
Warning | 1235 | This version of MySQL doesn't yet support 'sorting of non-scalar JSON values' |