Unable to read database.

SELECT MAX(`downloadRatio`) AS `max` FROM (SELECT ROUND(AVG(`resourceattachmentsDownloads` / DATEDIFF(CURDATE(), `resourceattachmentsTimestamp`)), 3) AS `downloadRatio` FROM `wkx_resource_attachments` GROUP BY `resourceattachmentsResourceId`) AS `wkx_t`SELECT DISTINCT `resourcecreatorCreatorSurname` AS `creatorSurname`, `resourceyearYear1`, `resourceyearYear2`, `resourcemiscId` FROM (SELECT DISTINCT `resourcemiscId`, `resourcemiscCollection`, `resourcemiscPublisher`, `resourcemiscField1`, `resourcemiscField2`, `resourcemiscField3`, `resourcemiscField4`, `resourcemiscField5`, `resourcemiscField6`, `resourcemiscTag`, `resourcemiscAddUserIdResource`, `resourcemiscEditUserIdResource`, `resourcemiscAccesses`, `resourcemiscMaturityIndex`, `resourcemiscPeerReviewed`, `resourcemiscQuarantine`, `resourcemiscAccessesPeriod`, `resourceyearId`, `resourceyearYear1`, `resourceyearYear2`, `resourceyearYear3`, `resourceyearYear4` FROM `wkx_resource_misc` LEFT JOIN `wkx_resource_year` ON `resourceyearId` = `resourcemiscId` LEFT JOIN `wkx_resource_creator` ON `resourcecreatorResourceId` = `resourcemiscId` ORDER BY COALESCE(`resourceyearYear1`, `resourceyearYear2`, `resourceyearYear3`) DESC LIMIT 440, 20) AS `wkx_t1` LEFT JOIN `wkx_resource` ON `resourceId` = `resourcemiscId` LEFT JOIN `wkx_resource_creator` ON `resourcecreatorResourceId` = `resourceId` ORDER BY CASE WHEN ((`resourceType` = 'book' OR `resourceType` = 'book_article') AND `resourceyearYear2` IS NOT NULL ) THEN (`resourceyearYear2`) ELSE `resourceyearYear1` END DESC, IF(`creatorSurname` IS NOT NULL, `creatorSurname`, `resourceTitleSort`) DESC, `resourceTitleSort` DESC LIMIT 0, 20

--> (Expression #1 of ORDER BY clause is not in SELECT list, references column 'usr_web48_5.wkx_resource.resourceType' which is not in SELECT list; this is incompatible with DISTINCT)