简体   繁体   中英

Mysql update query/procedure

I have a table with 2 columns, user and userMessage with table name as Messages I have another table with 2 columns as user and userMessageCount with table name as MessageCount . I am very new to programming. I need to write an update query or procedure something that will count the number of messages per user from Messages and store the count in MessageCount .

I am not able to understand the proper way of doing this. I understand this is a very basic question and I should study to solve this. i am running very late for a deadline. Please help me on this query.

Insert Into MessageCount 
Select user, count(*)
From Messages
Group by user

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM