I'm quite new at Linq queries, I just want to convert my DB query into Linq.
Here is my simple SQL query:
var query = "SELECT EnrollmentDate, COUNT(*) AS StudentCount "
+ "FROM Person "
+ "WHERE EnrollmentDate IS NOT NULL "
+ "GROUP BY EnrollmentDate";
var data = db.Database.SqlQuery<EnrollmentDateGroup>(query);
It is working fine , but how could it possible to write this query in Linq, I just can't convert the group by
statement into Linq. It seems somewhat tricky to convert into Linq.
Can anyone help me with this?