使用rand() 函数把limit关键字和order by子句结合起来解决了对mysql邮件列表的一个或者多个普通查询--从一个表中随机选择一个或者多条记录。这个过程首先设计到对表的随机排序,然后从结果集合中选择一个单独的记录。用sql语句可表达为:
select fld1,fld2 from tb1 order by rand() limit 0,1;
使用rand() 函数把limit关键字和order by子句结合起来解决了对mysql邮件列表的一个或者多个普通查询--从一个表中随机选择一个或者多条记录。这个过程首先设计到对表的随机排序,然后从结果集合中选择一个单独的记录。用sql语句可表达为:
select fld1,fld2 from tb1 order by rand() limit 0,1;
转载于:https://my.oschina.net/liujinofhome/blog/15788