Is there a way to simplify this and make it go faster? In SQL I use count(*) and count(distinct) in same query which gives me a faster result
Thanks a bunch.
int numberOfUsers = (from u in db.UseLogs
where u.DocID == docID
&& u.LogDate >= fromDate
&& u.LogDate <= to
select u.UserID).Distinct().Count();
int numberOfVisits = (from u in db.UseLogs
where u.DocID == docID
&& u.LogDate >= fromDate
&& u.LogDate <= to
select u).Count();
Conclusion
There is no Count( Distinct) in LINQ. Not EVERY SQL statement can be translated into LINQ.
Thanks for the help guys!