Sql查询tbl注释
Comment:tbl
CommentId PK
CommentEntry
CommentDate
Category
CommentCommentId
BlogEntryId FK
Insert into Comment(CommentId, CommentEntry, CommentDate, Category, CommentCommentId, BlogEntryId)
Values("1","I love shoes","10-3-2011","1","" ,"13"),
("2","I love shoes too","10-4-2011","1","1" ,"13"),
("3","There nice shoes in the mall","2","","13");
问题:对于给定博客条目的第一条评论,仅生成对该原始评论的任何进一步评论。应提示用户输入博客条目的唯一标识符。
ANS 假设:
("1","I love shoes","10-3-2011","1","" ,"13"),
("2","I love shoes too","10-4-2011","1","1" ,"13")
请帮助处理 sql
我想做一个自连接来接受 [BlogEntryId] 和产品第 1 条评论 'CommentCommentId=""' 以及第 1 条评论的所有评论。
请帮助sql:)
Comment:tbl
CommentId PK
CommentEntry
CommentDate
Category
CommentCommentId
BlogEntryId FK
Insert into Comment(CommentId, CommentEntry, CommentDate, Category, CommentCommentId, BlogEntryId)
Values("1","I love shoes","10-3-2011","1","" ,"13"),
("2","I love shoes too","10-4-2011","1","1" ,"13"),
("3","There nice shoes in the mall","2","","13");
QUESTION:Produce, for the first comment made on a given Blog entry, any further comments made on that original comment only. The user should be prompted for the Blog entry’s unique identifier.
ANS SUPPOSE TO BE :
("1","I love shoes","10-3-2011","1","" ,"13"),
("2","I love shoes too","10-4-2011","1","1" ,"13")
Please help with sql
I want to be to do a self join to accept [BlogEntryId] and product 1st Comment 'CommentCommentId=""' and all the Comments on that 1st comment .
help with sql please:)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需在原始查询中添加一点:
Just adding a bit to your original query:
我猜你想要这样的东西:
这是一个自连接。
我认为作业问题的答案很简单:
I guess you want something like this:
This is a self join.
I think the answer to the homework question is simply this: