Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 475043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:20:56+00:00 2026-05-13T00:20:56+00:00

I am looking to combine the following queries into one, where scouting.jumpGate is integer,

  • 0

I am looking to combine the following queries into one, where

  • scouting.jumpGate is integer,
  • scouting.astroLoc is a string,
  • scouting.ownerguild is a string and
  • scouting.galaxy is a integer

that cross-links to another table (and is my GROUP):

    Select TOP 3 
        scouting.jumpGate, 
        scouting.astroLoc, 
        scouting.ownerGuild, 
        scouting.Galaxy 
FROM    scouting 
WHERE   scouting.Galaxy = 1 
AND     scouting.ownerGuild = 'TEST' 
ORDER BY    scouting.jumpGate DESC, 
            scouting.astroloc DESC;

and

    SELECT TOP 3 
        scouting.jumpGate, 
        scouting.astroLoc, 
        scouting.ownerGuild, 
        scouting.Galaxy 
FROM    scouting 
WHERE   scouting.Galaxy = 2 
AND     scouting.ownerGuild = 'TEST' 
ORDER BY    scouting.jumpGate DESC, 
            scouting.astroloc DESC;

and

    SELECT TOP 3 
        scouting.jumpGate, 
        scouting.astroLoc, 
        scouting.ownerGuild, 
        scouting.Galaxy 
FROM    scouting 
WHERE   scouting.Galaxy = 3 
AND     scouting.ownerGuild = 'TEST' 
ORDER BY    scouting.jumpGate DESC, 
            scouting.astroloc DESC;

continued until

    SELECT TOP 3 
        scouting.jumpGate, 
        scouting.astroLoc, 
        scouting.ownerGuild, 
        scouting.Galaxy 
FROM    scouting 
WHERE   scouting.Galaxy = 79 
AND     scouting.ownerGuild = 'TEST' 
ORDER BY    scouting.jumpGate DESC, 
            scouting.astroloc DESC;

The code I have generated after reading on Microsoft’s website for this Greatest N Per Group problem is as follows:

Select  scouting.astroLoc, 
        scouting.galaxy, 
        scouting.jumpGate, 
        scouting.ownerGuild 
From    galaxy Inner Join 
        scouting On galaxy.[galaxy_ID] = scouting.galaxy 
Where   scouting.ownerGuild = 'SWARM' 
AND     (scouting.jumpGate) In (Select Top 3 scouting.jumpGate From scouting Where scouting.galaxy = galaxy.[galaxy_ID] Order By scouting.jumpGate Desc) 
Order By    scouting.astroLoc Desc, 
            scouting.jumpGate Desc

Basically, this is very close to what I would like. Everything seems to work. However, some of the GROUPS are not represented in the output even thought after eyeballing the data, each group has a record that satisfies the constraints of the query. Incidentally, if I take out the scouting.ownerGuild = ‘SWARM’ constraint, it works perfectly (but I need this constraint).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T00:20:56+00:00Added an answer on May 13, 2026 at 12:20 am

    How about:

    Select  scouting.astroLoc, 
            scouting.galaxy, 
            scouting.jumpGate, 
            scouting.ownerGuild 
    From    galaxy Inner Join 
            scouting On galaxy.[galaxy_ID] = scouting.galaxy 
    WHERE   (scouting.ID) In (
                 Select Top 3 scouting.ID
                 From scouting 
                 Where scouting.galaxy = galaxy.[galaxy_ID] 
                 And scouting.ownerGuild = 'SWARM' 
                 Order By scouting.jumpGate Desc) 
    Order By    scouting.astroLoc Desc, 
                    scouting.jumpGate Desc
    

    Otherwise it seems likely that the top 3 may include some

      where scouting.ownerGuild <> 'SWARM' 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for a jQuery plugin that can help me with the following: I
Looking for an example that: Launches an EXE Waits for the EXE to finish.
Looking for C# class which wraps calls to do the following: read and write
Looking for a Linux application (or Firefox extension) that will allow me to scrape
I would like to combine setter/getter in one method, in C++, in order to
I am trying to combine these four get variables (sch, val, lmt, ord) into
I am looking at building a shop solution that needs to be scalable. Currently
I'm looking for a solution on how to combine two widgets. I'm taling about
Overview: I am looking to create a site that will centralize a lot of
I am writing my first little Access 2003 application. I have two queries that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.