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
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
2 matches
Mail list logo