473,668 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1482
"Sonnich" <so************ @elektrobit.com > wrote in message
news:11******** *************@z 34g2000cwc.goog legroups.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******** *************@z 34g2000cwc.goog legroups.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
2425
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 that, for instance, if the result set contains 10,000 rows, then only the first 10 rows from the record set are output. Thank you,
1
13441
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 statement could potentially return 400,000+ rows, but I really only want the first 15 records found. I can put a lower-bound (col >= "xxx") in the WHERE clause but cannot specify an upper-bound (i.e. AND col <= "yyy"); therefore, depending on the value...
2
1595
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 good control over the install. I have (probably?) prevented unauthorised distribution thus: I have a module which checks the HD partition volume number. If it isn't the
3
3174
by: natG | last post by:
Hi; In db2 8.2, how do I limit a query resultset to x rows? Thanks, nat
3
1976
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 in advance, Kevin www.seoptimise.com
1
1544
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 a "..." to the end. <asp:DataList id="dlDataList" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow"> <ItemTemplate>
15
1779
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 (based on the primary key of the detail record). I've been trying with "TOP 3", but can't get anywhere. Using Access 2000. Something like: SELECT t1.*, TOP 3 t2.*
1
1181
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 opposed tot he 4 that are returned. I am using a group by, and one of the rows i need suppressed is unique not sure how i can do this. here is the query... SELECT tblBOARD_TEST_DETAILS.Part_Number , tblBOARD_TEST_DETAILS.Serial_Number ,...
2
2239
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. I've been extending the functionality tonight and have come across a problem... I'd like to limit the results based on comparing the total and paid results as below. QUERY SELECT...
0
8374
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8890
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8653
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7398
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5677
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2784
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2018
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.