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 3596120
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T19:56:38+00:00 2026-05-18T19:56:38+00:00

Considering the tables below, what is the best way to only return the team

  • 0

Considering the tables below, what is the best way to only return the team membership and its related player, but only one player from each team? The important part to note is that selection needs to be based on a given set of player ids. That is the starting point.

Using the example below I would have the player ids: 1,2,3 (among others) and what I need to end up with is the unique memberships from a list of user ids(1,2,3 in this case). I would want to end up with team_memberships with id 1 & 2

Thanks!

player
id | name
1  | bob
2  | joe
3  | tom

team_memberships
id | team_id | player_id
1  | 1       | 1
2  | 2       | 2
3  | 1       | 3

team
id | name
1  | jets
2  | kings
  • 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-18T19:56:38+00:00Added an answer on May 18, 2026 at 7:56 pm

    Do you mean

    Select team_id, Min(player_id)
    From team_Memberships
    Where player_id In (1,2,3)
    Group By team_id

    If the player selected needs to be based on some other attribute in the players table, then:

    Select team_id, 
       (Select Min(player_id) -- in case more than one player satisfies criterion
        From players 
        where playerId = m.Player_Id
           And [Some other ctiterion]) playerId
    From team_Memberships m
    Where player_id In (1,2,3)  
    Group By team_id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Considering the tables below, what is the best way to only return the team
I want to return 3 single values from 3 different tables. I want to
I have few DB tables, witch are build using inheritance from one table witch
Considering the code: <noscript><div>FOO</div></noscript> Running $('noscript').html(); returns &lt;div&gt;FOO&lt;/div&gt; but running $('noscript').text(); returns the raw
Considering the sample table below: Profile_ID Child_ID 1 1 1 2 1 3 2
I'm attempting to create a grid of availability from a number of tables to
I saw this on the codeigniter forum Considering the below code UPDATE a INNER
Much more to it but there are 3 tables... employees employee_id licenses license_id employee_id
I'm considering altering some tables to use nvarchar(50) as primary key instead of an
Suppose we have 4 tables as described below: Table 1: Element element_id [integer] (PK)

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.