获取其他表中其他表中的表的计数。
我从这段代码开始:
SELECT Nom_Folder,
(SELECT SUM(CountFiles)
FROM (
SELECT (SELECT COUNT(*) FROM files WHERE files.ConteurCategorie=categories.Conteur) AS CountFiles FROM `categories` WHERE categories.ConteurFolder=folder.Conteur
) X) AS NbrFiles
FROM folder
答案 0 :(得分:0)
我找到了解决办法:) :)
SELECT folder.Nom_Folder, folder.Type, COUNT(files.Conteur) FROM folder INNER JOIN categories ON categories.ConteurFolder=Folder.Conteur INNER JOIN files ON files.ConteurCategorie=categories.Conteur GROUP BY Folder.Conteur