Merging results
Posted: Fri Jul 21, 2006 9:42 am
Hi,
I have three tables as follows..
comments
topics
scores
each have a user_id and a user_points field. I want to take the values for user_points from comments and topics for all users, add these together and populate the scores table.
e.g user_id of 1 has 3 topics + 4 comments so my query should now populate scores as follows
user_id = 1
user_points = 7
etc..
Can this be done in a single query and if so how do I go about doing it?
Thanks in advance!!
M
I have three tables as follows..
comments
topics
scores
each have a user_id and a user_points field. I want to take the values for user_points from comments and topics for all users, add these together and populate the scores table.
e.g user_id of 1 has 3 topics + 4 comments so my query should now populate scores as follows
user_id = 1
user_points = 7
etc..
Can this be done in a single query and if so how do I go about doing it?
Thanks in advance!!
M