Skip to content

Instantly share code, notes, and snippets.

@florent-babylon
Created February 13, 2017 15:31
Show Gist options
  • Save florent-babylon/bd852930eff6a24274ae8401fa58c55f to your computer and use it in GitHub Desktop.
Save florent-babylon/bd852930eff6a24274ae8401fa58c55f to your computer and use it in GitHub Desktop.
[15:29:33]~/ λ sqlite3 test.sqlite
SQLite version 3.14.0 2016-07-26 15:17:14
Enter ".help" for usage hints.
sqlite> create table test(id integer, data text);
sqlite> insert into test values (1, '{"test": 1}'), (2, '{"test": 2}'), (1, '{"test": 3}'), (1, '{"test": 4}'), (2, '{"test": 2}');
sqlite> select id, data from test order by id;
1|{"test": 1}
1|{"test": 3}
1|{"test": 4}
2|{"test": 2}
2|{"test": 2}
sqlite> select distinct(id), GROUP_CONCAT(data) from test group by id order by id;
1|{"test": 1},{"test": 3},{"test": 4}
2|{"test": 2},{"test": 2}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment