I have a simple database table that is defined as such:
| Column Name | Data Type |
|---|---|
| AdministrativeAlertID | int |
| AdministrativeEventID | int |
| UserID | int |
| Notes | varchar |
| DateEntered | datetime |
| AcknowledgedByUser | int |
| AcknowledgedDate | datetime |
| ERIMNotes | varchar |
I have a SQL query to grab certain event types and group by the type and user while also selecting the MAX AlertID.
SELECT MAX(aa.AdministrativeAlertID) AdministrativeAlertID, aa.UserID, aa.AdministrativeEventID
FROM dbo.OSAMS_AdministrativeAlerts aa
WHERE aa.AdministrativeEventID IN (4,8,9,10)
GROUP BY aa.UserID, aa.AdministrativeEventID
ORDER BY aa.UserID
I've been struggling to get this working as an Entity Framework statement.
Does anyone have a suggestion on how to wrangle this beast ?