English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I want to desplay a search result in a web page. In a page there should be a maximum of 20 results. on request it will desplay the next 20 result on the same page. How can i write a query which returns only 20 rows from a table?

2006-07-31 07:19:24 · 5 answers · asked by Anu 2 in Computers & Internet Programming & Design

5 answers

{select stmt} LIMIT {start},{number}

where {select stmt} is your query.
{start} is the first record you want to bring back (depending on the DB may start with 0 or 1)
{number} is the number of records.

2006-07-31 07:59:23 · answer #1 · answered by John J 6 · 0 0

The answer will vary depending on the database you are using. For example, in Oracle you can write the query like this:

SELECT colName1, colName2... FROM TableName WHERE criteria1 AND criteria2... AND rownum<=20;

Hope this helps

2006-07-31 07:38:31 · answer #2 · answered by SmartSpider 4 · 0 0

What type of database are you using and whats an example of your query?

2006-07-31 07:34:55 · answer #3 · answered by rob 3 · 0 0

SELECT TOP 20 COLUMNNAMES FROM TABLENAME

2006-07-31 07:23:15 · answer #4 · answered by Special Ed 5 · 0 0

select top 20 blah blah blah...

2006-07-31 07:23:07 · answer #5 · answered by thaKing 4 · 0 0

fedest.com, questions and answers