2015-11-18 42 views

回答

4

聚集和COUNT应该是足够了:

SELECT A.ID, A.Date, COUNT(c.ID) AS Comments 
FROM Article A 
LEFT JOIN Comment c 
    ON A.id = c.FK_Article 
GROUP BY A.ID, A.Date 
ORDER BY A.ID; 
+0

@PinnyM是的,你是对的:) THX – lad2025

+1

大,它的工作原理,看起来容易,比我的预期。非常感谢你 :) – Bullman

相关问题