MYSQL updating data from other table

Posted by atif089 on Stack Overflow See other posts from Stack Overflow or by atif089
Published on 2010-04-20T14:38:24Z Indexed on 2010/04/20 14:43 UTC
Read the original article Hit count: 207

Filed under:
|
|

Hi,

I have two tables like of this structure

content (content_id, content_type, user_id, time, comment_count)

comments (comment_id, content_id, userid, comment, comment_time)

What I wold like to do is update the comments_count field with sum of comments i.e COUNT(content_id) from the comments table.

I am not able to figure out the right syntax

Thanks

© Stack Overflow or respective owner

Related posts about mysql

Related posts about tables