possible fix for Issue 1426:Count(*) query is incorrect when SQLFORM.grid() contains groupby parameter, thanks daveshih01

This commit is contained in:
mdipierro
2013-04-04 21:11:19 -05:00
parent cc8a21aedf
commit 0f0a62ef7f
2 changed files with 5 additions and 2 deletions
+4 -1
View File
@@ -2122,7 +2122,10 @@ class SQLFORM(FORM):
dbset = dbset(subquery)
try:
if left or groupby:
c = 'count(*)'
if groupby:
c = 'count(distinct %s)' % str(groupby)
else:
c = 'count(*)'
nrows = dbset.select(c, left=left, cacheable=True,
groupby=groupby).first()[c]
elif dbset._db._adapter.dbengine=='google:datastore':