diff --git a/pydal/dialects/mssql.py b/pydal/dialects/mssql.py index 907ab3d26..a5bbaf884 100644 --- a/pydal/dialects/mssql.py +++ b/pydal/dialects/mssql.py @@ -107,7 +107,7 @@ def delete(self, table, where=None): def select(self, fields, tables, where=None, groupby=None, having=None, orderby=None, limitby=None, distinct=False, for_update=False): - dst, whr, grp, order, limit, offset, upd = '', '', '', '', '', '', '' + dst, whr, grp, order, limit, upd = '', '', '', '', '', '' if distinct is True: dst = ' DISTINCT' elif distinct: @@ -125,8 +125,8 @@ def select(self, fields, tables, where=None, groupby=None, having=None, limit = ' TOP %i' % lmax if for_update: upd = ' FOR UPDATE' - return 'SELECT%s %s FROM %s%s%s%s%s%s%s;' % ( - dst, fields, tables, whr, grp, order, limit, offset, upd) + return 'SELECT%s%s %s FROM %s%s%s%s%s;' % ( + dst, limit, fields, tables, whr, grp, order, upd) def left_join(self, val, query_env={}): # Left join must always have an ON clause