How does MySQL randomly extract 10 items from a database? _php Tutorials

Source: Internet
Author: User
Problem
How to randomly extract 10 items from a database?
Workaround
There is no good solution, the efficiency is high, the method is simple.


Reference answer
If you have a cache system .... Load directly from the cache ....
Reference answer
No ~
Reference answer
Random syntax ...
Reference answer
Why not use the RAND function
Reference answer
Rand is definitely going to use it, but I don't know how to write this SQL statement.
Reference answer
SELECT ... From ... WHERE ... ORDER by RAND () LIMIT 10


Copy Code
Reference answer
Originally Posted by fising on 2009-1-4 11:54 [url=http://bbs.111cn.cn/redirect.php?goto=findpost&pid=814691&ptid=100356] Link marker [Img]http://bbs.111cn.cn/images/common/back.gif[/img][/url]
SELECT ... From ... WHERE ... ORDER by RAND () LIMIT 10
of learning
Reference answer
Thank you, I just wrote the same thing, but the prompt statement is wrong, does Rand have to capitalize? I was just a lowercase, wrong.
Reference answer
[url=http://www.linvo2008.cn/blog/?p=7] link marker Http://www.linvo2008.cn/blog/?p=7[/url]

http://www.bkjia.com/PHPjc/632599.html www.bkjia.com true http://www.bkjia.com/PHPjc/632599.html techarticle question How to randomly extract 10 of the contents of a database? The solution has no good solution, high efficiency, simple method. Refer to the answer if you have a cache system .... Directly from the slow ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.