如何使用mysql将行转换为随机列?不同的(image_url)
select p.email ,
image_url AS image_url_1,
image_url AS image_url_2 ,
image_url AS image_url_3,
image_url AS image_url_4
FROM
poll p
GROUP BY
email
ORDER by RAND()
此外,在此查询中
select email,
(select IFNULL((image_url from poll p1 order by rand() limit 1), NULL) as image_1,
(select IFNULL((image_url from poll p2 order by rand() limit 1), NULL) as image_2,
(select IFNULL((image_url from poll p3 order by rand() limit 1), NULL) as image_3,
(select IFNULL((image_url from poll p4 order by rand() limit 1), NULL) as image_4
from poll
group by email
null
如果少于 4 个 image_url如何显示以及如何区分?