How do I convert this SQL query to LINQ-to-SQL?:
select
COUNT(ua.UserAlertID) as Alerts,
ph.LastName +' '+ ph.MiddleName as Name,
ph.Email,us.UserSystemID,
ur.UserStatus from PHUser ph
inner join UserSystem us on us.UserID=ph.UserID
inner join UserRole ur on ur.UserID=ph.UserID
inner join Role rr on rr.RoleID=ur.RoleID
inner join UserAlerts ua on ua.SeniorID=ph.UserID
group by ph.LastName,ph.MiddleName,ph.Email,us.UserSystemID,ur.UserStatus
I have converted most of the above query to LINQ but I got stuck to counting the number of values on the ua.UserAlertID
column: COUNT(ua.UserAlertID) as Alerts
.
How do I convert that to LINQ?
Kindly suggest How to convert COUNT(ua.UserAlertID) as Alerts in Linq??
Thanks