Page 1 of 1

Aggregate function problem

Posted: Mon 07 Sep 2015 15:15
by dilbert
I think there is a problem with current version of Mysql provider (ver. 8.4.478).

The following simplified query (that has no real meaning) throws exception:

Code: Select all

from uu in DB.UserUsers
join uc in DB.UserConfigurations on uu.Id equals uc.Id_user
group uc.Config_key by uu.Id into grp
select new { IdUser = grp.Key, GroupCount = grp.Distinct().Count() }).ToList();
The exception is:
"Unknown column 't1.Id' in 'where clause'"

The problem is in DISTINCT() method. It works properly if it is omitted.
However, It should work with Distinct() method as well. Its MySql generated query could be like that:

Code: Select all

SELECT uu.id, COUNT(DISTINCT uc.Config_key)
FROM user_user uu JOIN user_configuration uc ON uu.id = uc.id_user
GROUP BY uu.id
Thank you for your attention.

Re: Aggregate function problem

Posted: Wed 09 Sep 2015 14:09
by Shalex
We have reproduced the issue and are investigating it. We will notify you about the result as soon as possible.

Re: Aggregate function problem

Posted: Tue 15 Sep 2015 14:51
by Shalex
This is a resource demanding task to fix the issue for all similar cases. Please send us a small complete test project with the corresponding DDL/DML script so that we can reproduce your particular case and offer you a workaround.