Getting max record from counts

SELECT CASEID
, SOURCEUSERID, count(*)
, ROW_NUMBER() OVER (PARTITION BY CASEID ORDER BY COUNT(*) DESC) AS RN
FROM LGNCC_CLOSEDCASEEVENTS WHERE caseid = 1086297
GROUP BY CASEID, SOURCEUSERID

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.