SQL Server query assistance needed
问题 I'm storing a bunch of data in a view (converted MS Access queries to views). Now what I'm trying to do is write a stored procedure to pull data based on when the data was added. Here is the query that I'm running Select Name, PlanID, ApptDate, 1stAppt, rn, from (Select *, row_number() over (partition by PlanID Order BY AddedonDate desc) as rn From vClientInfo) So this pulls all my data okay. The issue that I have to address is, the client actually comes in for the 1st appt and 2nd appt -