I have write a query in which I'm checking if user set his privacy to everyone it will return that result, if user sets to network then current user in my case its 5 will check that user must be his friend or friend of friend and if its set to friend then user should be his friend:
I try this query but issue is its giving an error:
#1241 - Operand should contain 1 column(s)
is there any way to write this query in different way and get appropriate result.
SELECT `U`.`UserGUID`, `U`.`FirstName`, `U`.`LastName`
FROM (`Users` U)
LEFT JOIN `UserPrivacy` UP ON `UP`.`UserID`=`U`.`UserID`
WHERE `UP`.`PrivacyLabelKey` = 'group_invite'
AND
IF(UP.Value='everyone',true,'')
OR
(UP.Value='network',U.UserID IN(SELECT F2.FriendID FROM Friends F JOIN Friends F2 ON F.FriendID = F2
.UserID WHERE F.UserID = 5 AND F2.Status='1' AND F.Status='1' GROUP BY F2.FriendID),'')
OR
(UP.Value='friend',U.UserID IN(SELECT FriendID FROM Friends WHERE UserID=5 AND Status=1),'')
AND U.UserID!=5
GROUP BY `U`.`UserID`