0
liked_table
-----------
user_id | topic | liked
2 | 3 | 1
3 | 3 | 1
5 | 3 | -1
topics_table
------------
topic_id | likes
3 | count(liked field from liked_table where topic from liked_table is this row's topic_id)
我可以像在Excel中一樣在MySQL中編寫這樣的公式嗎?將表中的數字反映到字段中(MySQL)