Please find the fiddle http://sqlfiddle.com/#!9/4a4aff/7
Friends_list Table
| id | user_id | Friend_id | status
| 1 | 1 | 24 | P
| 2 | 18 | 26 | P
User Table
| ID | email | password | ..N
| 1 | xx | xx | xx
| 2 | xx | xx | xx
from those both table i want to get all the users listed without the users whose status was P or B in friends list table it seems to be simple using joins but in wordpress this code is not working and the query is as below.
select DISTINCT u.ID, u.user_nicename from wp_users u
LEFT JOIN friends_list f ON f.friend_id=u.ID
WHERE f.status NOT IN ('P', 'B')