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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:05:41+00:00 2026-05-21T03:05:41+00:00

Ok, this is a little tricky to explain but can be very easy to

  • 0

Ok, this is a little tricky to explain but can be very easy to implement.

I have a table with the following structure:

`match_id` int(69) NOT NULL auto_increment,
`event_id` int(6) NOT NULL,
`users_id` int(6) NOT NULL,
`matches` int(6) default NULL

so here is a sample of the data

33      11      54      1221
32      11      54      21
31      11      21      54
30      11      43      54

So, in English, this is what needs to happen:
It is a personal selection chart where user1 selects user2 and vice-versa. I only need the USERS_ID where they are mutually selected.
If I am looking for matches = 54, I would need to get users_id =21. Because 54 matched 21 and 21 matched 54.

Any ideas on how to write the SQL statement for this?
Thanks a lot.
Bruno.

  • 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-21T03:05:41+00:00Added an answer on May 21, 2026 at 3:05 am

    Try this:

    SELECT DISTINCT a.user_id
      FROM <YOUR_TABLE> a INNER JOIN <YOUR_TABLE> b
        ON a.matches = b.users_id
       AND b.matches = a.users_id
     WHERE a.matches = 54
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a little tricky so bear with me: I have a PHP script
This one is a little tricky. Say I have this XmlDocument <Object> <Property1>1</Property1> <Property2>2</Property2>
This is fairly simple in Windows, but a little tricky in Linux. I am
Tricky one to explain this. I have a custom built properties grid. The left
This is a little tricky to explain what is happening. http://easyuniv.com/staging/gonzaga/ If you go
This is a little tricky to describe, but hopefully there is a solution. I
So this may be a little tricky, but take a look at the div
Okay, this is a little tricky to describe, but I think best described by
This can be a little tricky and I'm not sure if it's correct way.
This one is a little tricky to explain. I would like to create a

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.