I have a table that counts the number of hospital visits by hospital and doctor. Since there are hundreds of doctors per hospital, I'd like to limit the return of doctors to the top 5 based on descending highest number of visits. It would look like:
Hospital 1 Provider 1 500 visits
Hospital 1 Provider 2 300 visits
Hospital 1 Provider 3 250 visits
Hospital 1 Provider 4 200 visits
Hospital 1 Provider 5 100 visits
Hospital 2 Provider 1 1200 Visits
Hospital 2 Provider 2 800 visits etc.
How would I code the number of visits to exclude any but the top 5 records? I already have the sum of visits at the provider level... Hope this makes sense... Thanks so much! PS, not too savvy at SQL yet--I use query design view... I know I know!
lol
Hospital 1 Provider 1 500 visits
Hospital 1 Provider 2 300 visits
Hospital 1 Provider 3 250 visits
Hospital 1 Provider 4 200 visits
Hospital 1 Provider 5 100 visits
Hospital 2 Provider 1 1200 Visits
Hospital 2 Provider 2 800 visits etc.
How would I code the number of visits to exclude any but the top 5 records? I already have the sum of visits at the provider level... Hope this makes sense... Thanks so much! PS, not too savvy at SQL yet--I use query design view... I know I know!
