


How to randomly extract 10 items from the database in mysql? _PHP Tutorial
Jul 13, 2016 am 10:51 AM
Question
How to randomly extract 10 pieces of content from the database?
Solution
Is there any good solution that is efficient and simple?
Reference answer
If you have a caching system....load directly from cache....
Reference answer
No~
Reference answer
random syntax...
Reference answer
Why not use Rand function
Reference answer
Rand must be used, 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
Original post by Fising on 2009-1-4 11:54 [url=http://bbs.111cn.cn/redirect.php?goto=findpost&pid=814691&ptid=100356]Link tag [img]http://bbs. 111cn.cn/images/common/back.gif[/img][/url]
SELECT ... FROM ... WHERE ... ORDER BY RAND() LIMIT 10
Learning
Reference answer
Thank you. I wrote it like this just now, but the prompt statement is wrong. Does rand have to be capitalized? I just lowercase it, wrong.
Reference answer
[url=http://www.linvo2008.cn/blog/?p=7]Link tag http://www.linvo2008.cn/blog/?p=7[/url]

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to optimize MySQL query performance in PHP?

How to use MySQL backup and restore in PHP?

How to insert data into a MySQL table using PHP?

How to fix mysql_native_password not loaded errors on MySQL 8.4

How to use MySQL stored procedures in PHP?

How to create a MySQL table using PHP?

Detailed tutorial on establishing a database connection using MySQLi in PHP

iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos
