Friday, March 9, 2012

MySQL limit with start, offset

Hi,

I need the equivalent for below mysql query :

select *from test limit 5, 20

I know that the below is possible in SQL Server :

select top 20 * from test where column1 not in (select top 5 column1 from test).

But my problem is I want a generic solution wherein I will not be aware of the columns available within the table.

Please advice,

- MiraWithout knowing the columns? You need to understand that TOP is meaningless in a relational database (SQL Server or MySQL) without an ORDER BY clause that specifies a column. Otherwise, you have no guarantee about the order of the data that comes back, and it can change from one execution to the next.

No comments:

Post a Comment