On database I have two tables: users which contains all the user registration details and friends which contains user friends relation data (friend_one, friend_two are the FOREIGN KEYs to references users.user_id), status (0 - expectation, 1 - denied, 2 - accepted) and timestamp. friend_one - is always initiator of friendship. Girls can add to friends only boy and boys can add only girls. So when i try get amount of friends of user - boy with id 5 for example :

exports.amountOfFriends = function (req, res) {
var user = req.session.user,
userId = req.session.session_id;
if(userId == null){
res.redirect("/login");
return;
}
let sql = `SELECT COUNT(*) myCount FROM friends WHERE status = ? AND friends_one =? OR friends_two =? `;
let post = [2, userId, userId];
connection.query(sql, post, (err, result) => {
if(err){
console.log(err)
}
res.json(result);
console.log(result[0].myCount);
});
};
I get value - 2. But correct value is 3. Because user with id 5 has three friends. Please help me fix this problem.

