0
我想要提取所有討論並添加所有UserDiscussion行的列數,其中'bookmarked'列在討論中爲真。MySQL加入count並且其中
Table: Discussion
-----------------
DiscussionID
Name
.....
Table: UserDiscussion
---------------------
UserID
DiscussionID
Bookmarked (Boolean)
這是我的查詢,但它是不正確的:
SELECT d.*, COUNT(*) as BookmarkCount
FROM Discussion d
LEFT JOIN UserDiscussion ud
ON ud.DiscussionID = d.DiscussionID
WHERE ud.Bookmarked = true;
...和您的服務器的規則允許它。 – Strawberry