From 9e81544ebd180787298af2b92b478726c214e5dc Mon Sep 17 00:00:00 2001 From: niphlod Date: Sun, 26 Jun 2016 23:02:55 +0200 Subject: [PATCH] fixes #382 --- pydal/dialects/mssql.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pydal/dialects/mssql.py b/pydal/dialects/mssql.py index 887719541..7ded8906f 100644 --- a/pydal/dialects/mssql.py +++ b/pydal/dialects/mssql.py @@ -244,9 +244,10 @@ def _rebuild_select_for_limit(self, fields, tables, dst, whr, grp, order, f_iproxy = ', '.join([ self._as(o, n) for (o, n) in zip(f_inner, f_outer)]) f_oproxy = ', '.join(f_outer) - return 'SELECT%s %s FROM (' + \ + interp = 'SELECT%s %s FROM (' + \ 'SELECT%s ROW_NUMBER() OVER (%s) AS w_row, %s FROM %s%s%s)' + \ - ' TMP WHERE w_row BETWEEN %i and %i;' % ( + ' TMP WHERE w_row BETWEEN %i and %i;' + return interp % ( dst, f_oproxy, dst, order, f_iproxy, tables, whr, grp, lmin, lmax )