.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> Others >> Post New QuestionBookmark and Share Subscribe to Forum

How to get records from n to m using MYSQL Query

Posted By: Suma     Posted Date: September 21, 2009    Points:2   Category :Others
Hi,
How to get records from n to m using MYSQL Query. My Requirement is i need to get records from MYSQL Tables say table1 and it has 1000 records, Now i need to get records from 10 to 50.

I need MYSQl query to fetch the rows.

Responses
Author: Lakhan Pal Garg             
Posted Date: September 21, 2009     Points: 5   

Hi Suma-

Use this Query:

SELECT * FROM (
SELECT * ,ROW_NUMBER() OVER (ORDER BY CLASSID desc)AS ROW FROM TblClass)AB
WHERE AB.ROW>=10 AND AB.ROW<=50

Here Replace TblClass with your table Name And CLASSID with column Name either identity or any other ..

Thanks & Regards
Lakhan Pal Garg
Free Code Snippets
http://lakhangarg.blogspot.com/

Author: Suma             
Posted Date: September 22, 2009     Points: 5   

HI Lakhan,

Thanks for your help but i need MySQL Query. Above SQL Query is it seems for SQL Server. Could you please help me with MYSQL Query?

Thanks
Suma

Author: Faizal             
Posted Date: September 22, 2009     Points: 5   

Hi,

you can use the MySQL LIMIT keyword to get the rows or records between n to m like this


SELECT * FROM <TABLENAME> LIMIT 10,20;




Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend