Mysql
 sql >> Database >  >> RDS >> Mysql

Raggruppa per valore RAND()

Usa una sottoquery.

SELECT r.nID,
(SELECT r1.val FROM T1 r1 WHERE r.nID=r1.nID ORDER BY rand() LIMIT 1) AS 'val' FROM T1 r 
GROUP BY r.nID

http://sqlfiddle.com/#!2/357b8/18