Hi all
I have written a report to identify referrals with more than 5 appointments, and have been asked to add in the first appointment date. My TSQL script uses ROW_NUMBER() over (partition by a.Uniqueref order by care_contact_dttm) row where Row>5 to select the patients, this works fine.
I know the first appointment date should be as above where Row=1 (or is there another way) , but I but do not know how to get in the same script.
Any ideas welcome. I am using SQL Server 2008 R2.
I have written a report to identify referrals with more than 5 appointments, and have been asked to add in the first appointment date. My TSQL script uses ROW_NUMBER() over (partition by a.Uniqueref order by care_contact_dttm) row where Row>5 to select the patients, this works fine.
I know the first appointment date should be as above where Row=1 (or is there another way) , but I but do not know how to get in the same script.
Any ideas welcome. I am using SQL Server 2008 R2.