MYSQL find matching ids from another column

How can I select matching data from another column given this example:

id    user_id     match_id
1     3           4
2     3           5
3     4           3
4     4           6

Note: ID column is an auto_increment column

So basically the output should be that user_id 3 and user_id 4 are matched since user_id 3 has user_id 4 in the match_id column while user_id 4 has user_id 3 in the match_id column

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s