MySQL Forums
Forum List  »  Newbie

Insert Data From Another Table
Posted by: Russ Lefebvre
Date: July 05, 2012 03:06PM

I'm having problems getting a loop to work.

I have a Users table with a User_ID column and a Post_Count column.

I have another table called Posts that has all the users' posts. I have to use the User_ID field in the Posts table to count. I want to count the number of posts for each user and enter that number into the Post_Count column in the Users table.

I cannot figure out how to make the counts go into the the Users table in one query. I can do it if I count one user at a time but can't make it loop through each user and add the count.

Any help would be appreciated.

Thanks,
Russ

Options: ReplyQuote


Subject
Written By
Posted
Insert Data From Another Table
July 05, 2012 03:06PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.