Yes, sorry ... I forgot to mention that I use MySql 3.23.55 and unfortunately cannot upgrade to 4.1.0 where finally subselects would be supported.
Unfortunately the GROUP BY wont help. I tried:
SELECT
folder1.nr,
folder1.name,
COUNT(folder2.nr) AS subfolders,
COUNT(files.nr) AS files
FROM
folder AS folder1
LEFT JOIN folder AS folder2 ON folder1.nr = folder2.refer
LEFT JOIN files ON folder1.nr = files.folder
WHERE
folder1.nr = '4'
GROUP BY
folder1.nr,folder1.name,folder2.nr,files.nr
ORDER BY
folder1.reihe
...but this would only give a number of results from subfolders*files.
A funny thing I found out is:
When I GROUP BY folder2.nr only, I get as result in 'subfolders' AND in 'files' what I expect to be in 'files' only and in mysql_num_rows() what I expect to be in 'subfolders' ... when I GROUP BY files.nr only, mysql_num_rows() would return what I expect in 'files' ... and in 'subfolder' and 'files' is the value, that should be only in 'subfolders' ... 😕
As long as I get the proper values (wherever they might turn out ... lol) I might be able to continue but I hope there's somebody out there who can give me a hint, how a problem like this is supposed to be solved 😉
Greets
Georg