It is necessary to display the number of articles that have read the user's referrals. There are three tables: users, referals(id_user,id_referals(пользователь который пригласил в систему)), history(id_user,id_articles(статья которая прочитана)) .
My request is not true:
SELECT COUNT( DISTINCT(history.id_articles)), users.login FROM referals,users,history WHERE referals.id_referals = 1 AND users.id = referals.id_user The user has not read any articles, but displays 3.
history.id_user = users.idin WHERE? - user6550