3 回答
TA贡献1934条经验 获得超2个赞
SELECT g.*FROM table g JOIN (SELECT id FROM table WHERE RAND() < (SELECT ((4 / COUNT(*)) * 10) FROM table) ORDER BY RAND() LIMIT 4) AS z ON z.id= g.id
关于极限安装的注意事项
关于联接的注意事项
注哪里条款
注子查询
SELECT g.*FROM table gORDER BY RAND()LIMIT 4
行家
order by rand()
反方
TA贡献1884条经验 获得超4个赞
ORDER BY RAND()
ORDER BY RAND()
SELECT idFROM testTableORDER BY RAND();
JOIN
SELECT t.*FROM testTable tJOIN (SELECT id FROM `testTable` ORDER BY RAND()) AS z ON z.id= t.id WHERE t.isVisible = 1LIMIT 100;
SELECT u.id, p.photo FROM users u, profiles p JOIN (SELECT id FROM users ORDER BY RAND()) AS z ON z.id = u.id WHERE p.memberid = u.id AND p.photo != '' AND (u.ownership=1 OR u.stamp=1) LIMIT 18
RAND()
添加回答
举报