Aggregate function problem

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
dilbert
Posts: 68
Joined: Tue 28 Apr 2009 10:11

Aggregate function problem

Post by dilbert » Mon 07 Sep 2015 15:15

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.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Aggregate function problem

Post by Shalex » Wed 09 Sep 2015 14:09

We have reproduced the issue and are investigating it. We will notify you about the result as soon as possible.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Aggregate function problem

Post by Shalex » Tue 15 Sep 2015 14:51

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.

Post Reply