The question is more about query optimization. The fact is that the user can add a different type of publication (news, articles, notes, photos). All this is stored according to different tables.
What would be the optimal request for counting each type of publication?
UNION ALL not appropriate, as the tables have a different number of columns.
I did so, I do not know how fast the option is:
SELECT ( SELECT IF(`Count` IS NULL, 0, `Count`) FROM likes WHERE IdNote = 600 ) AS likes, ( SELECT COUNT( * ) FROM commenttousers WHERE CommentToUsersIdToUser =600 ) AS reviews FROM likes, commenttousers GROUP BY CommentToUsersIdToUser LIMIT 0 , 30 In my example, the IF condition does not work for some reason.