|
Setting a field equal to the row count of another table
Is there a way, in MySQL, to set a field in table "A" equal to a row count of another table where id = 'x'?
What I'm doing is building my own blog, more accurately the commenting system. I have a field in the table containing the blog information, which includes a field "num_comments". I'd like to be able to post comments without having to update both the comments table, and the blog table. I'm wondering if there is a specific function within MySQL that will allow me to do this?
While I'm here, how would I go about incrementing an int field without querying for the value first?
|