Hi, I have 3 tables, each table will show records of users posting messages.
I have managed to sum the number of times each user has posted a message on each table and now I want to sum these 3 individual values together for each user.
Here is what I have managed so far:
Table USERMESSAGE:
SELECT U.SenderID, COUNT(U.SenderID) AS U_NUM
FROM USERMESSAGE AS U
WHERE U.SenderID != U.ReceiverID
GROUP BY U.SenderID
Table COMMENT:
SELECT C.UserID, COUNT(C.UserID) AS C_NUM
FROM COMMENT AS C
GROUP BY C.UserID
Table FRIENDLIST:
SELECT F.UserID, COUNT(F.UserID) AS F_NUM
FROM FRIENDLIST AS F
WHERE F.ListName = 'News Feed'
GROUP BY F.UserID
But not all user will post in all tables, so some UserID will not appear in some tables.