I have two tables: users and sub_list.
Table users contain username and table sub_list contains username, subscribed_user.
**table users**
*username:* john,harris,samantha,peter,joe,max
**table sub_list**
*username:* harris, harris, peter
*subscribed_user:* samantha, john, joe
Let's say my name is harris...
Now I want query to select a random user from table users limited by 1, where harris is not subscribed to that user in table subscribed_user.
So I don't want to get results like: samantha and john because I've already subscribed to them.
This code below doesn't work.
SELECT *
FROM users
WHERE users.username='harris' NOT IN (
SELECT username
FROM sub_list)
ORDER BY RAND() DESC
LIMIT 1