Monday, September 30, 2013

.Net: Unknown column 'GroupBy1.K1' in 'field list'

I was having the error

Unknown column 'GroupBy1.K1' in 'field list'

The query was:

                    var results =
                        from cs in skydeskDB.Cases
                        where
                        cs.AgentId == AgentId
                        && cs.ClosedAt >= iniDate
                        && cs.ClosedAt < endDate
                        group cs by cs.ClosedAt.Value.Hour into g
                        select new
                        {
                            closedcasecounter = g.Count(),
                            daynumber = g.Key
                        };

After spending a lot of time on internet I found a post that suggested that the problem was a mysql connector  bug so I updated it from 6.6.5 to 6.7.4. But the problem continued so I had to group the data using a for loop :(

If you find any solution, please let me know in the comments section.

Resources:
http://bugs.mysql.com/bug.php?id=46742

No comments: