Sqlite group_concat function Sqlite group_concat function sqlite sqlite

Sqlite group_concat function


Some other databases allow an ORDER BY clause in there, but SQLite just uses whatever order the records happen to be read from the table/index/subquery.

If you are using one fixed version of SQLite, and if your database schema does not change, and if you never re-execute ANALYZE, and if your SQL query stays the same, then the order will stay the same.

However, these conditions are hard to guarantee.Usually, it would be a better idea to not aggregate that field and to use an ORDER BY clause instead, or to use a separator and sort the values in your code.