Re: [sqlite] random row from group

2014-07-08 Thread Clemens Ladisch
Patrick Donnelly wrote: > I'm trying to find a way to select a random row from a group (rather > than "arbitrary"). Something like: > > SELECT attr1, attr2 > FROM foo > GROUP BY attr1 > ORDER BY attr1, random() > > but of course ORDER BY is done after GROUP BY has selected an > arbitrary row. To

[sqlite] random row from group

2014-07-08 Thread Patrick Donnelly
Hi, I'm trying to find a way to select a random row from a group (rather than "arbitrary"). Something like: SELECT attr1, attr2 FROM foo GROUP BY attr1 ORDER BY attr1, random() but of course ORDER BY is done after GROUP BY has selected an arbitrary row. Looking online, I've seen non-standard