?
Solved

limiting rows

Posted on 2004-04-18
6
Medium Priority
?
286 Views
Last Modified: 2008-03-06
how can i limit rows while getting result from database?
0
Comment
Question by:abhishek2002
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 12

Accepted Solution

by:
venkateshwarr earned 200 total points
ID: 10853363
The LIMIT clause may be used to limit the records returned by the SELECT statement. You specify the start row (start from zero), and the number of records returned. The following example lists the first 10 records from the search table.

SELECT * FROM search LIMIT 0, 10;

The following example would retrieve the next ten records from the table.
SELECT * FROM search LIMIT 10, 10;  
0
 
LVL 1

Expert Comment

by:drag0n
ID: 10855791
You can also store the start and end rows in variables to be able to produce the paging functions you see everywhere. You pass these variables in the url with strings for next, previous paging
0
 
LVL 7

Expert Comment

by:madwax
ID: 10867000
Repost from duplicate question:

Hi abhishek2002,

If you are using MySQL you can write

SELECT * FROM myTable LIMIT 0,10

where 0 is startrow and 10 is number of records you want to return

Read more: http://dev.mysql.com/doc/mysql/en/SELECT.html

//jan
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
This article discusses how to implement server side field validation and display customized error messages to the client.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question