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

fix SQL error in scheduled_vs_spent_time #3

Merged
merged 1 commit into from Jul 6, 2011
Merged

fix SQL error in scheduled_vs_spent_time #3

merged 1 commit into from Jul 6, 2011

Conversation

veloutin
Copy link

@veloutin veloutin commented Mar 3, 2011

ActionView::TemplateError (PGError: ERROR: column "p.name" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: SELECT p.name, p.id, SUM(hours) AS hours, SUM(logged_hours) ...

I was tired of not seeing 'My page' anymore since I added the block from this plugin, which caused a 500
all the time. So there is a fix :P

@@ -25,7 +25,7 @@
sql << " GROUP BY project_id, date"
sql << ") AS results"
sql << " LEFT JOIN #{Project.table_name} AS p ON p.id = results.project_id"
sql << " GROUP BY project_id"
sql << " GROUP BY p.id, p.name"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both p.id and p.name must be in the GROUP BY to allow them to be in the SELECT directly

bradbeattie added a commit that referenced this pull request Jul 6, 2011
fix SQL error in scheduled_vs_spent_time
@bradbeattie bradbeattie merged commit 20d4757 into bradbeattie:master Jul 6, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants