SunQuest
 
           MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old November 30th, 2004, 03:06 PM
ayab ayab is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 1 ayab User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question putting constraints on the number of tuples

Hi,

Im new to the forum so I hope I am posting it in the right place...

Is there a way to constraint the number of tuples returning form a query?
I have a database with about 20000 tuples. When asking the simple query:
select * from table, is there a way to return only the first 1000 tuples?

Thanks in advance,
ayab

Reply With Quote
  #2  
Old December 14th, 2004, 12:33 AM
Angela Angela is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Location: Netherlands
Posts: 11 Angela User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Yes there is:
Select * from table limit 1000;
This will give you the top 1000 from the resultset.
You can use limit to do scrolling in resultsets too.

For instance:
You want the first 5 rows, and then the next 10:
Code:
select * from table limit 5;
select * from table limit 5,10;


The second parameter will be the number of results returned, the first one is the offset.
So, in this case: start from number 5, so skip 5, return the next 10. Results numbers 6-15 will be returned here.

Hope this helps!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > putting constraints on the number of tuples


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway