I have a problem with a query. Here is the query.
SELECT UserID, MAX(UserName) as UserName, MAX(TransactionTime) as TransactionTime, MAX(LastAction) as LastAction
FROM UserActivities
WHERE OrganizationID = 26465
GROUP BY UserID
There are so many records for particular user at different TransactionTime. I want to take LastAction along with other records. How can I do it? Is SQL partition will work here?