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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:11:41+00:00 2026-06-14T13:11:41+00:00

team1 +———-+———-+ | id1 | name | +———-+———-+ | 1 | a | |

  • 0
team1
+----------+----------+
| id1      | name     |
+----------+----------+
| 1        | a        |
| 2        | b        |
| 3        | c        |
+----------+----------+

team2
+----------+----------+
| id2      | name     |
+----------+----------+
| 1        | d        |
| 2        | e        |
| 3        | f        |
+----------+----------+

play
+----------+----------+----------+
| id3      | id1      | id2      |
+----------+----------+----------+
| 1        | 1        | 1        |
| 2        | 1        | 3        |
| 3        | 2        | 1        |
| 4        | 3        | 2        |
| 5        | 2        | 3        |
+----------+----------+----------+

I’m new to sql. I am struggling with how to set a counting condition. Let’s say for the tables above, I want to find a player from team1 who plays with a player from team2 that has played or will play at least two times total. So basically, if a value from id2 shows up more than once, then any value from id1 that plays against id2 should be part of the result. Just by looking at the table, I would want it to return id1 = 1 and id1 = 2 if it was without redundancies. I can’t wrap my head around how to go about this.

  • 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-14T13:11:42+00:00Added an answer on June 14, 2026 at 1:11 pm

    Try:

    select distinct p1.id1
    from play p1
    join (select id2
          from play
          group by id2
          having count(*) > 1) p2
    on p1.id2 = p2.id2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two dictionaries a = {'home': {'name': 'Team1', 'score': 0}, 'away': {'name': 'Team2',
So say I have List<String> teamList = new LinkedList<String>() teamList.add(team1); teamList.add(team2); teamList.add(team3); teamList.add(team4); teamList.add(team5);
So I have this code: Team1 = [Red, 10] Team2 = [Green, 5] Team3
<form> <input name=Team1 id=team1 type=text value=Team1?> <button id=dostuff value=Go>Go</button> </form> <div id =nicteamcolumn>Team: </div>
Currently having problem with a SQL query, It is as follows UPDATE table SET
I have one mysql table called 'games' with the fields: id, team1, team2, and
Consider the following: details = Hash.new # Example of this Hash's final look details[team1]
I have a Hashmap in Java like this: private Map<String, Integer> team1 = new
I have an array that represents soccer match results ( team1 - the name
I have a question about string in TCL: HANDLE_NAME /group1/team1/RON proc HANDLE_NAME {playerName} {

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.