I have a table t
with columns foo
and bar
:
foo bar
a x
a y
b z
I want to write something like
select foo, count(*) as num, SOMETHING(bar) from t group by foo;
and get
foo num bar
a 2 x <--- or y, I don't care
b 1 z
I.e., SOMETHING
should select an arbitrary value that appeared in a group (first, last, random - I don't care).
Is there a way to do it in sqlite3
?