Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

SQL Help

$
0
0
I have a Contract table with a CoverageCode column. I what pull 5 records for each CoverageCode. Currently I am doing this:SELECT TOP 5 * FROM Contract WHERE CoverageCode = 1UNIONSELECT TOP 5 * FROM Contract WHERE CoverageCode = 2etc.....there are over 100 if I go this routeIs there a better way to do this?

Viewing all articles
Browse latest Browse all 3145

Trending Articles