Thursday, February 27, 2014

Need a PIVOT-like solution

select count(LabDate) from dbo.LabsPerPatient where PatientID = @PatientID


to find how many you will need for your current data.


Check the article I recommended, it explains how to do this dynamically (find the maximum number of rows per a patient and generate the query you need).




For every expert, there is an equal and opposite expert. - Becker's Law





My blog




My TechNet articles


No comments:

Post a Comment