Skip to content

mysql随机查询输出数据语句

转载本站文章请注明:
转载来至:[记录与PHP的PK经历]
本文链接: mysql随机查询输出数据语句

原来以为mysql没有随机输出数据的方法呢,google后还是搜索到了结果,代码如下:
select * from tablename order by rand() limit 10

http://www.pkphp.com/(1)mysql 随机函数(2)mysql 随机查找(1)php mysql 随机(1)mysql 搜索 随机 记录(1)php查詢輸出(1)mysql随机记录函数(1)mysql 输出 最大一个记录(1)mysql 随机查询(2)mysql 随机测试数据(1)php mysql数据查询(1)php mysql 输出数据方式(1)数据库 随机 输出 select(1)链接myslq语句(1)mysql 随机记录(1)

中文关键字:mysql 数据 查询 随机 google 代码 语句 输出 tablename 原来 还是 结果 方法 select 搜索

3 Comments

  1. 这个方法似乎不是很好啊。很浪费服务器资源的
    最好的方法还是
    1.提取数据库里ID最大最小值
    2.用PHP的随机函数取出随机数
    3.接着用SELECT查询语句提取ID=随机值
    这个方法比较省资源的 :)

    askie Reply:

    没有具体测试,不知道哪个占用资源较多!

    Posted on 29-Jul-08 at 6:41 pm | Permalink
  2. 你竟然不知道这个。。。。
    汗!

    askie Reply:

    汗!

    Posted on 29-Jul-08 at 10:39 pm | Permalink
  3. 嘿嘿,这语句不知道,确实要挨板子。

    askie Reply:

    哈哈!菜了点!

    Posted on 30-Jul-08 at 1:49 pm | Permalink

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*
Note: Commenter is allowed to use '@User+blank' to automatically notify your reply to other commenter. e.g, if ABC is one of commenter of this post, then write '@ABC '(exclude ') will automatically send your comment to ABC. Using '@all ' to notify all previous commenters. Be sure that the value of User should exactly match with commenter's name (case sensitive).