Ok, I should have tested this before asking. I had assumed that "If the SELECT statement is *a non-aggregate query*, then each expression in the result expression list is evaluated for each row in the dataset filtered by the WHERE clause"
on https://www.sqlite.org/lang_select.html#resultset means, that, if it is a non-aggregate query, I would get every row regardless whether there is a GROUP BY or not. But actually the description after *Side note: Bare columns in an aggregate queries.* ... applies also to non-aggregate queries: I get exactly one arbitrary row in each group. But then I have a related question: to get my hands on each row in SELECTs with GROUP BY I could write an aggregate extension function. How do I see there, when a group ends and a new one starts? I.e. How do I implement the xStep and xFinal C functions as requested at https://sqlite.org/c3ref/create_function.html The built in SQL avg function returns the average in each group. How would I implement say variance, skewness, ... functions that do the same? _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users