我有两张桌子:
CREATE TABLE "object_comment"
("object_id" INTEGER PRIMARY KEY NOT NULL,
"object_comment_text" TEXT,
"object_comment_title" TEXT,
"object_comment_date" DATETIME)
和
CREATE TABLE "object_comment_mark"
("object_id" INTEGER PRIMARY KEY DEFAULT null,
"object_comment_mark_value" FLOAT DEFAULT null,
"object_comment_mark_date" DATETIME DEFAULT null)
我需要将它们与 object_id 字段连接起来,但唯一的行也应该出现在结果中。(有一些相等的 object_id 值我需要加入一行,一些 object_id 值不同,但它们应该在结果表中)
现在我有这个选择查询:
SELECT *
FROM object_comment
LEFT OUTER JOIN object_comment_mark ON object_comment.object_id = object_comment_mark.object_id
但在这种情况下,我没有第二个表中 object_id 具有唯一值的行。有什么帮助吗?
编辑:我需要什么
对象评论
1 | bla-bla | first | 2013
2 | be-be | sec | 2014
object_comment_mark
1 | 5 | 2013
4 | 3 | 2013
结果
1 |bla-bla | first| 2013 | 5 | 2013
2 | be-be | sec | 2014 | |
4 | | | | 3 | 2013