Skip to content

Instantly share code, notes, and snippets.

-- When you need to find the submitted datetime of the second interaction submitted by each and every doc in our database
LEFT JOIN (
SELECT *
FROM (
SELECT
ROW_NUMBER() OVER(PARTITION BY [PhysicianID] ORDER BY [WhenSubmitted]) AS ROW,
[PhysicianID],
[WhenSubmitted]
FROM [dbo].[Recording]
) AS tmp