Thanks for the answer. Igor Tandetnik wrote: > This monstrosity gives the correct answer in your specific example, but > it relies on there being exactly two tags per folder. It can be any number of tags per folder.
Igor Tandetnik wrote: > > Consider normalizing your database. Split into two tables - folders and > tags - with a one-to-many relationship between them. Then the solution > would be trivial. How can I do that considering that it can be any numbers of tags? Igor Tandetnik wrote: > > select > (select count(*) from (select distinct folder from t1)), > (select count(*) from ( > select replace(rtrim(tags,'abcdefghijklmnopqrstuvwxyz'),',','') > from t1 > union > select replace(ltrim(tags,'abcdefghijklmnopqrstuvwxyz'),',','') > from t1)); > > Same caveat applies. Ok, this answer my question at least for normal columns. Thanks. How should I do to store tags in my database and been able to count them? Do you know how other programs like firefox do this? -- View this message in context: http://www.nabble.com/Sqlite-question%3A-group-by-column-with-multiple-tags--tp22153722p22159627.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users