Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Limiting the number of rows in a avg() query
Message
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
00716104
Message ID:
00716167
Views:
20
This message has been marked as a message which has helped to the initial question of the thread.
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
Map
View

Click here to load this message in the networking platform