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

  • SEARCH
  • Home
  • 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 8640755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:21:23+00:00 2026-06-12T11:21:23+00:00

I have a table of quarterback statistics. Each row in the table represents one

  • 0

I have a table of quarterback statistics. Each row in the table represents one QB’s performance in one game. The unique ID for each row is called gameId and is composed of the player’s ID plus the game date.

What I want to do is use a select statement to generate a list of all unique quarterbacks in the table, who have thrown at least one completion.

I’m trying to do that with this statement:

SELECT * FROM swdata
WHERE gameComp > 0 AND gameId IN (
   SELECT MAX(gameId) FROM swdata GROUP BY playerId)
ORDER BY playerLastName

The first clause is gameComp > 0, and the second clause is to winnow the list down to unique quarterbacks.

What I want to happen is for the first clause to be run, and then for the second clause to be run on the results of the first clause.

But what’s actually happening is that they run concurrently, and this results in some players being omitted from the results.

So, I know I’ve structured it wrong. Can anyone help me get it right?

  • 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-06-12T11:21:24+00:00Added an answer on June 12, 2026 at 11:21 am

    If you want unique playerIds, wouldn’t the following work?

    select distinct playerId
    from swdata
    where gamecomp > 0
    

    If you want more than one column, then join back to the original table, with a query such as:

    select s.*
    from swdata s join
         (select playerId, max(gameId) as maxgameId
          from swdata
          group by playerId
         ) m
         on s.gameId = maxgameId
    

    This is in response to your question about distinct. The distinct returns the distinct values of everything in the select clause. So, the following are equivalent:

    select distinct playerID, playerLastName, playerFirstName
    from swdata
    

    and

    select playerID, playerLastName, playerFirstName
    from swdata
    group by playerID, playerLastName, playerFirstName
    

    Both of these return all unique combinations of the three columns that appear in the data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table called Direccion other called Cliente each one defined like this public
I have table called FinalForgotten which only contains one field called aname. The field
I have table with two columns (varchar from, varchar to). This table represents connections
I have table with countries, resorts and photos for resorts. Each photo may be
I have table defined with FlexiGrid. Call to all variables is ok. One column
I have table with data 1/1 to 1/20 in one column. I want the
I have table Owner in my database where one of the field (System) saved
I have table of over 4 million rows and accidentally in one column there
I have table tblsale . In this table i have field called BillType ,
I have table /entity called SaleRecord with fields such as @Entity public class SaleRecord

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.