Fix grid count when using groupby on MSSQL

Any query like SELECT COUNT(*) from (SELECT COUNT(*) FROM ...) will fail with 'No column name was specified for column 1 of '_tmp'', so I'm providing an alias for the subquery's field
This commit is contained in:
Tim Nyborg
2015-11-30 16:09:53 +00:00
parent db37cf6a58
commit 1b77c2294a
+1 -1
View File
@@ -2079,7 +2079,7 @@ class SQLFORM(FORM):
## if it's not an integer
if cache_count is None or isinstance(cache_count, tuple):
if groupby:
c = 'count(*)'
c = 'count(*) AS count_all'
nrows = db.executesql(
'select count(*) from (%s) _tmp;' %
dbset._select(c, left=left, cacheable=True,