SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to get limited record in sql as ” limit ” in M
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

lakshmanjoyforever
Starting Member

1 Posts

Posted - 07/11/2012 :  00:36:45  Show Profile  Reply with Quote
How to get limited record in sql as ” limit ” in Mysql?

We are having the limit keyword in mysql so that we can limit the data so that we can improve the performance of the application.

Check the below link for the solution

http://lakshmannuli.wordpress.com/2012/07/09/how-can-to-get-limited-record-in-sql-as-limit-in-mysql-14/

lionofdezert
Aged Yak Warrior

Pakistan
885 Posts

Posted - 07/11/2012 :  02:54:05  Show Profile  Visit lionofdezert's Homepage  Send lionofdezert a Yahoo! Message  Reply with Quote
SQL Server 2012 provides more better solution
SELECT *
FROM MyTable
ORDER BY TableColumn
FETCH NEXT 10 ROWS ONLY;

In prior vesions, you can use CTE (Common Table Expression) to achive this functionality.

;WITH CTE (SELECT *, ROW_NUMBER() OVER (ORDER BY TableColumn)AS RowNum FROM MyTable)
SELECT * FROM CTE WHWERE RowNum >=1 and RowNum<=11

--------------------------
http://connectsql.com/
Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22744 Posts

Posted - 07/11/2012 :  08:56:52  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
quote:
Originally posted by lionofdezert

SQL Server 2012 provides more better solution
SELECT *
FROM MyTable
ORDER BY TableColumn
FETCH NEXT 10 ROWS ONLY;

In prior vesions, you can use CTE (Common Table Expression) to achive this functionality.

;WITH CTE (SELECT *, ROW_NUMBER() OVER (ORDER BY TableColumn)AS RowNum FROM MyTable)
SELECT * FROM CTE WHWERE RowNum >=1 and RowNum<=11

--------------------------
http://connectsql.com/


You need OFFSET too

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000