select user_id,name, login,lastseen from users where user_id
in((select friend_id from connections where user_id=1 and connection=1)
union (select user_id from connections where friend_id=1 and connection=1))
我想做一些這樣的工作,但這個查詢顯示錯誤。如果我獨立運行這個子查詢沒有backets它工作正常。 ,也是我怎麼可以重寫此查詢增加perforamance如何使用聯合在SQL中的子查詢
請標記具體是什麼DB你正在用嗎。 –