troubleshooting Question

Using Top, but not as the first field in a qry

Avatar of indy500fan
indy500fan asked on
Microsoft SQL ServerMicrosoft SQL Server 2005
4 Comments2 Solutions199 ViewsLast Modified:

In a nutshell, I want to get the TOP 4 sectionTimes FOR EACH ResultitemID in my table.  

Here is the objective:

Select ResultItemID, TOP 4 (SectionTime)  From SectionTimes WHERE SectionID=-1 and SectionTime > -1

Obviously I can't do that.

I could run some vb code and get all the pertinant ResultItemID, then do individual qry's as Select Top 4 SectionTime From SectionTimes Where ResultItemID = X

I'm hoping there is a more efficient way!

Thanks in advance!
Join our community to see this answer!
Unlock 2 Answers and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros