简体   繁体   中英

How do I limit the results of an SQL query?

I want to limit the results of a query in MySQL. I want the query to search 5000 rows but return only 5 of the 50 that found. How is it possible to do this?

Any help appreciated.

This is pretty basic SQL stuff. Check out the LIMIT modifier. You want to do something like:

    SELECT id FROM table LIMIT 5
SELECT * FROM ANYTABLE LIMIT 50;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM