您好,我有兩個查詢怎樣區域相交2聯合查詢
一個是
SELECT userid_one AS id FROM `friends` WHERE `userid_two` = '$UserId' AND `requeststatus` ='accepted'
UNION
SELECT userid_two AS id FROM `friends` WHERE `userid_one` = '$UserId' AND `requeststatus` ='accepted'
它給了我的用戶ID 41,38,61,62,64
二是
SELECT DISTINCT `userid` FROM `groupmembers` WHERE `groupid` =24
它給了我61,49,62
我想導致用戶ID,他們不是兩個結果 即:49,41,38,64,38
我如何能做到這一點
什麼DBMS您使用JOIN ? –