473,383 Members | 1,815 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

limiting amount of returned rows?

Hi!

How do I limit the amount of returned rows?

Lets say, that I want only the latest 400 rows (of e.g. 4034634 rows) -
is there a parameter for that like rownum in Oracle?

e.g. select * from someplace where rownum < 400 order by sometimefield?

BR
Sonnich

Mar 27 '06 #1
3 1465
"Sonnich" <so************@elektrobit.com> wrote in message
news:11*********************@z34g2000cwc.googlegro ups.com...
How do I limit the amount of returned rows?


The optional LIMIT clause of queries can do this.

Read about it on this page:
http://dev.mysql.com/doc/refman/5.0/en/select.html

Starting at the bullet item that begins, " The LIMIT clause can be used to
constrain the number of rows returned..."

Regards,
Bill K.
Mar 27 '06 #2
Sonnich wrote:
Hi! How do I limit the amount of returned rows? Lets say, that I want only the latest 400 rows (of e.g. 4034634 rows) -
is there a parameter for that like rownum in Oracle? e.g. select * from someplace where rownum < 400 order by sometimefield? BR
Sonnich

http://dev.mysql.com/doc/refman/4.1/...imization.html

select * from someplace where order by sometimefield limit 400;

Mar 27 '06 #3

Bill Karwin wrote:
"Sonnich" <so************@elektrobit.com> wrote in message
news:11*********************@z34g2000cwc.googlegro ups.com...
How do I limit the amount of returned rows?


The optional LIMIT clause of queries can do this.

Read about it on this page:
http://dev.mysql.com/doc/refman/5.0/en/select.html

Starting at the bullet item that begins, " The LIMIT clause can be used to
constrain the number of rows returned..."


Thanks, that works well.

Sonnich

Mar 28 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: nzanella | last post by:
Hello, I am running SQL Server 2000. I would like to know whether Microsoft Transact-SQL has a method for limiting the result set from a query in a way analogous to MySQL's LIMIT keyword, so...
1
by: BF | last post by:
Hello, I am trying to find out if there is a way to limit the number of rows returned when a cursor is opened. I am using DB2 version 7 on z/OS. The SELECT statement in my DECLARE CURSOR...
2
by: Jo Davis | last post by:
access fe and access be. later the be might be sql server I don't want people to pass this application around. And I want control over usage. I want it to 'expire' after a while. I have fairly...
3
by: natG | last post by:
Hi; In db2 8.2, how do I limit a query resultset to x rows? Thanks, nat
3
by: kevin | last post by:
Hi, I am looking to return the first 50 characters from a database field. Does anyone know if there is a SQL function that returns a defined amount of characters from a database field? Thanks...
1
by: Roffers | last post by:
Hi everyone. I've got this problem that I really have no idea how to solve. I have a datalist that brings back x amount of rows, I need to limit this datalist by 100 characters and then append...
15
by: Hexman | last post by:
Hello All, How do I limit the number of detail records selected in a Master-Detail set using SQL? I want to select all master records for a date, but only the first 3 records for the details...
1
by: bfountain | last post by:
I have a query which someone wrote in Access and I have been charged with the task of making it work in SQL Server. The query runs fine, but the problem is that I need to get back only 3 records as...
2
hodgeman
by: hodgeman | last post by:
My second thread on thescripts, so hoping to get the same feedback and help as last time... I've developed an online invoicing and payment system for all my accounts for my web design company....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.