Quantcast
Channel: DaniWeb Solved Topics
Viewing all articles
Browse latest Browse all 564

AND OR in the same statement

$
0
0

Hello i have a mysql statement and i want to add more parameters to get different results.

SELECT DISTINCT M.message,F.friend_one,F.friend_two, F.role,U.uid,U.username
    FROM users U,friends F, messages M WHERE ( U.status='1' AND F.friend_one = '88') OR (F.friend_two='88' ) AND F.role='friend'

88 is the users id so i want to show M.message from friends of 88 but not 88 itself
hints:
when one is becoming friend with other friend_one is 88 -for example- and friend_two another user id or vice versa
M table has id of user as a column of course


Viewing all articles
Browse latest Browse all 564

Trending Articles