4

如何获取随机用户名。

SELECT a.mod_name, u.user_name, a.id from type a, users u 
WHERE a.id=u.mod_type
ORDER BY mod_type Desc ";
4

3 回答 3

4

您可以ORDER BY RAND()为此使用:

SELECT a.mod_name, u.user_name, a.id
FROM type a, users u
WHERE a.id=u.mod_type
ORDER BY RAND()
于 2012-11-19T04:35:25.953 回答
3

关于什么

编辑:

select a.mod_name, u.user_name, a.id from type a, users u where a.id=u.mod_type 
order by mod_type DESC, rand();

?

于 2012-11-19T04:41:35.540 回答
2

Mysql支持RAND()函数

 select a.mod_name, u.user_name, a.id from type a,
 users u where a.id=u.mod_type
 order by RAND(),mod_type Desc ";
于 2012-11-19T04:36:28.637 回答