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
https://forums.phpfreaks.com/topic/120400-solved-mutual/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.