I want to group by Date of datetime cloumn(eg.CreateTime ='20017-01-01 01:01:01') to use Sum
aggregate functions.
- EntityFramework 6 Code first
- NetFramework 4.5
MYSQL Server 6.9.9
var myData = from certifiedRecord in DbSet join shopInfo in DbContext.ShopInfos on certifiedRecord.ShopId equals shopInfo.ID into joinedCertify from shopCertifiedRecord in joinedCertify group shopCertifiedRecord by EntityFunctions.Date(certifiedRecord.CreateTime) into g orderby g.Key select new ShopCertifiedDayInfoResponse { Day = g.Key.Value, NormalCount = g.Sum(t => t.CertifiedType.CompareTo(1)), VipCount = g.Sum(t => t.CertifiedType.CompareTo(2)) };
But there is not EntityFunctions.Date
function for EF with Mysql.
Is there a way to solve the problem?
Now I just use the CustomQuery to solve the Problem.
I Just want to know how to use EntityFunctions
(maybe another thins) to solve the Problem.In another way, I want to using Linq for EF to solve the problem.