I have two tables following:
CREATE TABLE `following` (
`follower` int(1) unsigned NOT NULL,
`followee` int(1) unsigned NOT NULL,
PRIMARY KEY (`follower`,`followee`)
) ENGINE=IoDB DEFAULT CHARSET=latin1
and association_record:
CREATE TABLE `association_record` (
`user_id` int(1) unsigned NOT NULL,
`post_id` int(1) unsigned NOT NULL,
`answer_id` int(1) unsigned NOT NULL,
`date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`user_id`,`post_id`)
) ENGINE=IoDB DEFAULT CHARSET=latin1
What I want are the users who are following the user with id '5' who do not have an association_record for the post with id '88'. The below SQL is what I came up with from reading other posts, but it doesn't get me the desired results.
select f.follower
from following f
left outer join response_record r
on f.follower = r.user_id
where f.followee = 5
and r.post_id = 88
and r.user_id is null
