请参阅下面以了解我想要什么:
------------------------------
Friend | User
------------------------------
2 | 1
3 | 2
2 | 5
4 | 2
------------------------------
当我搜索 value时,我希望我的搜索结果在and2
中返回相关值,如下所示:Friend
User
--------------------------
Friends of 2
--------------------------
1 - (from column User )
3 - (from column Friend)
5 - (from column user )
4 = (from column friend )
我想要一列搜索结果,如下所示:
--------------------------
Friends of 2
--------------------------
1
3
5
4
如何通过在 SQL Server 中使用 SELECT 查询来完成此操作?