ASP Hosting sale!
Double disk space and transfer for FREE!
Limited time offer! Act Now!

aspdev | articles | tutorials | forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Selecet top 5 rows in MySQL?

 
Post new topic   Reply to topic    ASPdev.org Forum Index -> SQL Programming (MS SQL Server, MS Access, MySQL)
View previous topic :: View next topic  
Author Message
Stacy



Joined: 12 Oct 2004
Posts: 9

PostPosted: Thu Feb 16, 2006 10:14 am    Post subject: Selecet top 5 rows in MySQL? Reply with quote

Hi All,

I'm using MySQL and ASP and I'm trying to come up with a SQL statement that selects only the 5 top results, from one of my MySQL tables. Is this possible to be done in MySQL or I'll have to select everything in the table and then just get the first 5 rows returned from the ASP code?



Thank you!

Stacy
Back to top
View user's profile Send private message
Don



Joined: 22 Oct 2004
Posts: 28

PostPosted: Thu Feb 16, 2006 1:43 pm    Post subject: Reply with quote

Yes you can do that with MySQL. It should be something like that:

SELECT * FROM tblYourTable LIMIT 0,5




Don
Back to top
View user's profile Send private message
Stacy



Joined: 12 Oct 2004
Posts: 9

PostPosted: Fri Feb 17, 2006 2:12 pm    Post subject: Reply with quote

Thanks Don,

If I execute the following MySQL statement, what will it do:

SELECT * FROM tblYourTable LIMIT 4,5

Would it get rows # 4 and 5?



Thanks again,
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ASPdev.org Forum Index -> SQL Programming (MS SQL Server, MS Access, MySQL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group

SQL Tutorial