Saturday, 10 September 2016

How to get first 5 records from a table without using LIMIT in MYSQL ?

Table Name: records
Here, we have 10 records in the table, however, we need to retreive 5 records without using LIMIT keyword.
Query :
 SELECT limitrecordsone.sno, FROM records limitrecordsone WHERE (SELECT COUNT(*) FROM records limitrecordstwo WHERE limitrecordstwo.sno <= limitrecordsone.sno) <=5

No comments:

Post a Comment

Your comment is so valuable as it would help me in my growth of knowledge.