Hello Stephen,
I cheked that "select count(distinct) is available in MySQL 5.X versions.
Could you try the bellow?
mysql> select count(distinct MediaId) from Media;
+-------------------------+
| count(distinct MediaId) |
+-------------------------+
| 60 |
+-------------------------+
1 row in set (0.00 sec)
The complete query worked for me (the server has 22 clients):
mysql> select Client.Name, count(distinct Filename.FilenameId) from Client, Filename, File, Job where Filename.FilenameId=File.FilenameId and File.JobId=Job.JobId and Job.ClientId=Client.ClientId group by Client.ClientId;
+------------------+-------------------------------------+
| Name | count(distinct Filename.FilenameId) |
+------------------+-------------------------------------+
| xxxxxx-fd | 6590 |
| yyyyyy-fd | 222632 |
| zzzzzzz-fd | 441730 |
...
+------------------+-------------------------------------+
22 rows in set (16 min 42.63 sec)
Best regards,
Ana