Hi, I'm using sql 2005 express
I would like to select one entry from dbo.DailyStepsGoals based on the studyid and ds.DateGoalIsSet (DateTime) is the most recent. How can I put that in Tsql? Thank you.
select p.StudyId, d.LastName, p.DateOfFirstVisit, ds.TargetNumber as StepTargetNumber, from dbo.Patients p inner join dbo.Doctors d on p.DoctorId = d.DoctorIdleft join dbo.DailyStepsGoals ds on p.StudyId = ds.StudyId and ds.DateGoalIsSet