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 `creatorSurname`, `resourcemiscId` FROM (SELECT DISTINCT `resourcemiscId`, `resourcemiscCollection`, `resourcemiscPublisher`, `resourcemiscField1`, `resourcemiscField2`, `resourcemiscField3`, `resourcemiscField4`, `resourcemiscField5`, `resourcemiscField6`, `resourcemiscTag`, `resourcemiscAddUserIdResource`, `resourcemiscEditUserIdResource`, `resourcemiscAccesses`, `resourcemiscMaturityIndex`, `resourcemiscPeerReviewed`, `resourcemiscQuarantine`, `resourcemiscAccessesPeriod`, `wkx_c`.`resourcecreatorCreatorSurname` AS `creatorSurname`, `wkx_c`.`resourcecreatorResourceId` AS `resourcecreatorResourceId` FROM `wkx_resource_misc` LEFT JOIN `wkx_resource_creator` AS `wkx_c` ON `wkx_c`.`resourcecreatorResourceId` = `resourcemiscId` ORDER BY `wkx_c`.`resourcecreatorCreatorSurname` ASC LIMIT 320, 20) AS `wkx_t1` LEFT JOIN `wkx_resource` ON `resourceId` = `resourcemiscId` LEFT JOIN `wkx_resource_year` ON `resourceyearId` = `resourcemiscId` ORDER BY `creatorSurname` ASC, `resourceTitleSort` ASC, CASE WHEN ((`resourceType` = 'book' OR `resourceType` = 'book_article') AND `resourceyearYear2` IS NOT NULL ) THEN (`resourceyearYear2`) ELSE `resourceyearYear1` END ASC LIMIT 0, 20

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