Here is the query:
SELECT c.*, f.file
FROM `category` c
LEFT JOIN
(
SELECT `file`, catId
FROM `file`
ORDER BY sortId
) f
ON f.catId = c.catId
GROUP BY c.catId
ORDER BY c.sortId
This used to work fine until a mysql update. I have been circling on this for a while now and I can't seem to find a solution.
Here is the last option I tried:
SELECT *
FROM `file`
LEFT JOIN `category`
ON `file`.catId = `category`.catId
GROUP BY `file`.catId
ORDER BY `category`.sortId
Any guidance would be appreciated.