Can anyone please tell/suggest me how can i store and retrieve comments multiple/different values in/from the single column?
任何人都可以告诉/建议我如何在单列中存储和检索多个/不同值的注释?
Scenario: Some user makes a post and rest of the users are posting comments on it.
场景:某些用户发布帖子,其余用户在其上发布评论。
Here i have a table names "posts" in MySQL database with the following columns "id","posted_by","post" and "comments"
这里我在MySQL数据库中有一个表名“posts”,其中包含以下列“id”,“posted_by”,“post”和“comments”
Now i'm stuck in the comments part where i'm trying to store the comments made by different people in the single column and retrieving and displaying comments them right below the post.
现在我陷入了评论部分,我试图将不同人员的评论存储在单个列中,并在帖子下方检索并显示评论。
I thought of using ALTER and create new columns for different comments but i don't think thats a good idea thats why i'm posting this question.
我想过使用ALTER并为不同的评论创建新列,但我认为这不是一个好主意,这就是为什么我发布这个问题。
Thank You
1 个解决方案
#1
2
Just create another table
只需创建另一个表
COMMENT
id comment commenter post datetime
and remove comments
from POST table, so now POST can have many COMMENT
并从POST表中删除注释,所以现在POST可以有很多COMMENT
#1
2
Just create another table
只需创建另一个表
COMMENT
id comment commenter post datetime
and remove comments
from POST table, so now POST can have many COMMENT
并从POST表中删除注释,所以现在POST可以有很多COMMENT