﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
30633	Group by concat(field1,field2) producing wrong result.	bishwadeep	nobody	"I am new to Django and I am enjoying it. I ran into an issue while creating a SQL query for my project. I want the following query to run using Django 
Query:
Select id,field1,field2,field3 FROM table WHERE field1 = somevalue
Group by concat(field1,field2) ORDER BY somefield

However I am not able to get the desired query. It keeps on adding group by id which is not what I want.
Django query:
result = query.annotate(person=Concat(F('field1'), F('field2'))).annotate(Count('person', distinct=True))
Outputs: 
SELECT id FROM table WHERE my condition GROUP BY id ORDER BY field

Please let me know if you have any questions."	Uncategorized	closed	Database layer (models, ORM)	dev	Normal	invalid	mysql group by		Unreviewed	0	0	0	0	0	0
