I need to convert the follwing query into linq or lambda expression
SELECT count(Hid.HouseholdID) FROM
(SELECT HouseholdID FROM tblTmpJoinAll
WHERE loyal = 1 Group By HouseholdId
HAVING Count(distinct BasketID)>1) as Hid;
So Far I have tried
lst.Where(f => f.Flybuys == true)
.GroupBy(h=>h.HouseholdID)
//.Where(x=>x.)// don't know what to right here
.Select(h => h.Key).Count();
I think this code works.
lst.Where(f => f.Flybuys) // you don't need == true here
.GroupBy(f => f.HouseholdID)
.Where(f => f.GroupBy(i => i.BasketID).Count() > 1)
.Count();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.