I'm trying to perform groupby with aggregate function inside a subquery using lambda expression .I've manage to write the query using SQL but failing to do the same using Lambda expression. How could we write the same query using Lambda or may be LINQ
select
[user_ID], FirstName, LastName, Phone, Fax, EmailAddress
from table1
where [user_id] in
(select [user_id]
from table2 group by [USER_ID]
having (sum(case when isregistered is not null then 1 else 0 end)) = 0
)
Below is the model representation
public class AccountDetails
{
public string Username { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Phone { get; set; }
public string Fax { get; set; }
public string EmailAddress { get; set; }
public bool? IsRegistered { get; set; }
public string User_Id { get; set; }
}