+ -
当前位置:首页 → 问答吧 → 好友表的问题

好友表的问题

时间:2011-11-24

来源:互联网

PHP code


id   f_to   f_from   status
1     mike   jener    0
2     mike   jay      1
3     patric  mike    1
4     mike    lucy    1    



status = 1 为正常好友关系,mike 就有三个好友,要怎么取出这三个好友的名字?

作者: SWORDMYTH   发布时间: 2011-11-24

SQL code
select f_to from  table1 where f_from='mike' and status=1
union 
Select f_from from table1   where f_to='mike' and  status=1

作者: ACMAIN_CHM   发布时间: 2011-11-25

你这好友关系表的好友关系应该成对出现才对吧

作者: rucypli   发布时间: 2011-11-25