General information
Forum:
Microsoft SQL Server
We do similar queries. We have "facilites" that may change all of part of their definitions and when they are changed we enter an effective date. This allows us to track a range of data based on the history ( effective ) date. I assume you could do the same by first querying to get the record ids corresponding to the latest 20 visits to the physician ( or the dates if you don't use surrogate keys ) for that criteria and then in your main query join back into the first query with an inner join on those record ids ( or dates ) to limit your result set to only the records you want based on the date range.
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only