Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Select 4 most recent results

$
0
0
Hi All, I am creating a database in SQL2K for collating test results taken at regular intervals across several different sites and frequencies. The table will look something like this:

Site Date Data
A 01/01/2013 …
B 02/01/2013 …
C 03/01/2013 …
A 04/01/2013 …
B 05/01/2013 …
C 06/01/2013 …
And so on...

In total there will be about 300 sites, with up to 12 records per site every year. I want to be able to create a view showing the 4 most recent results for each site. Is there a simple way of doing this? Obviously getting the most recent result for each site is quite straight forward, but I can't work out how to get the last four. Unfortunately this is on a 2k box, although I could (at a push) use a 2k8 box if needed.

Thanks in advance for any help.

Viewing all articles
Browse latest Browse all 13329

Trending Articles