Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use functions in group by queries #152

Open
wedi-dev opened this issue Jul 20, 2020 · 1 comment
Open

Cannot use functions in group by queries #152

wedi-dev opened this issue Jul 20, 2020 · 1 comment
Labels

Comments

@wedi-dev
Copy link

wedi-dev commented Jul 20, 2020

Because of quotes in this code cannot use functions e.g. domain(sessionURL) in group by

sql += '\nGROUP BY %s' % comma_join('`%s`' % field for field in self._grouping_fields)

Resulting query fails:

SELECT domain(sessionURL) FROM `table`
GROUP BY `domain(sessionURL)` 
ORDER BY domain(sessionURL)

With error:

Missing columns: 'domain(sessionURL)'

Dropping quotes in group by fixes the problem.

@ishirav
Copy link
Contributor

ishirav commented Jul 21, 2020

Thank you for the bug report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants