Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is it possible
Message
From
12/02/2013 14:10:41
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Is it possible
Environment versions
SQL Server:
SQL Server 2008
Application:
Desktop
Miscellaneous
Thread ID:
01565799
Message ID:
01565799
Views:
92
Before I make myself completely insane trying to do it, say I have a TestFrameWork table that looks like
Cat     TypeB      TypeC     TypeD     TypeE
----------------------------------------------------------------
40          5              3             6            4
41
.
.
.
Where the numbers 5,3, etc are the number of records I need of each Cat and Type and will change periodically but I can't predict what they will be; the 'B','C','D','E' are the difficulty letters (DiffLet). But I need to be able to pull x number of records based on Cat and DiffLet

I know we can say
Select top 5 from (filename) where Cat = '40' and DiffLet = 'B'
Union
(Select top 3 from (filename) where Cat = '40' and DiffLet = 'C'
Union
...
but is it possible to say
Select top TestFrameWork.TypeB from (filename) where Cat = '40' and DiffLet = 'B'
?
"You don't manage people. You manage things - people you lead" Adm. Grace Hopper
Pflugerville, between a Rock and a Weird Place
Next
Reply
Map
View

Click here to load this message in the networking platform