Single SQL Query with inner joins -


ok have 2 tables, 1 users , other follow logs, have php script in need send request find user follow.

alright, let's i'm on user 'gretar' (promote_account) , need find user follow, need select users have promotion_left > 0 , isn't in followed_account twitter_name 'gretar'.

users_table: enter image description here

follow_table: enter image description here

edit: read on , didn't explain enough, sorry that, i've changed now.

you want left outer join show users not have record in follow table. in tsql, this:

select *   users_table u   left outer join follow_table f on f.followed_account = u.promote_account     , twitter_name = 'gretar'   f.id null     , u.promotion_left > 0     , u.promote_account <> 'gretar'