catfan / Medoo

The lightweight PHP database framework to accelerate the development.
https://medoo.in
MIT License
4.83k stars 1.15k forks source link

LIMIT is not supported on mssql #183

Closed tobiascapin closed 7 years ago

tobiascapin commented 9 years ago

Limit is not supported by mssql, however, I think could be quite easy to add a ROW_NUMBER ( ) OVER() as _uniquealias field in select statement and a WHERE _uniquealias BETWEEN X and Y statement.

carestad commented 8 years ago

Maybe one could add support for using TOP(N) instead? I have done that in my forked version here: https://github.com/carestad/Medoo/commit/876df443b89e55d7a5748f1b721fa13e191fd8af

The implementation might not have been done right, and I'm not really a MSSQL guru, but it works for my use. Maybe just adding a support for TOP itself in the WHERE clause would be better.

carestad commented 8 years ago

Fixed it for get() too in latest commit: https://github.com/carestad/Medoo/commit/479fe6f997866ad3a94dc0a760e76a1c3d8c38e4

catfan commented 7 years ago

It supports limit for MSSQL 2012+ with FETCH ROW on Medoo 1.4.