Jump to content

[SOLVED] mutual...


phorcon3

Recommended Posts

ID              USER1                          USER2

1                test                            test1

2                test1                            test2

3                test3                            test1

5                test                              test3

6                test                              test2

7                test3                            test4

 

i am test.. and im connected with test1..

 

and now i wanna check which users i have in common with test1 = test2,test3

 

how can i do that in one single query?

 

to find out if im connected with test1, id have to do

 

<?php

$a=mysql_query("SELECT * FROM `table` WHERE `USER1` = 'test' AND `USER2` = 'test1' OR `USER2` = 'test' AND `USER1` = 'test1'");

?>

 

but how do i check which other ones (test2,test3) we have in common?...id have to use two queries again ..but maybe theres a sql func to do it with one single query.. does anyone know?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.