Re: How to enforce a specific order of group_concat?
Dominique Devienne <[email protected]> Mon, 2 Mar 2020 16:02:00 +0100
| Newsgroups | gmane.comp.db.sqlite.general |
|---|---|
| Message-ID | <CAFCRh-_Gar7SCTP-UVh1JmWH0zzDuR4dmKJOB0p4nNkoj+KQ5w@mail.gmail.com> |
On Sun, Mar 1, 2020 at 10:58 PM mailing lists <[email protected]> wrote: > Are there any other solutions / possibilities? I thought someone more knowledgeable than I about Window Functions [1] would answer, but since nobody mentioned them so far, I'll do it, as I believe this is the "SQL native" way to achieve what you want (modulo DISTINCT perhaps). Notably (from the doc): Every aggregate window function can also work as a ordinary aggregate function, simply by omitting the OVER and FILTER clauses. Furthermore, all of the built-in aggregate functions of SQLite can be used as an aggregate window function by adding an appropriate OVER clause [2] has an example with group_concat() and OVER (ORDER BY ...). I assume that's what you need, someone better at Window Functions then me (not difficult!) can confirm or not that. --DD [1] https://www.sqlite.org/windowfunctions.html [2] https://www.sqlite.org/windowfunctions.html#aggwinfunc _______________________________________________ sqlite-users mailing list [email protected] http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users