DatabaseException

Expression #1 of ORDER BY clause is not in SELECT list, references column 'elgg_ocd.elgg_entities.time_created' which is not in SELECT list; this is incompatible with DISTINCT

QUERY: SELECT DISTINCT EXTRACT(YEAR_MONTH FROM FROM_UNIXTIME(time_created)) AS yearmonth
FROM elgg_entities where type='object' and subtype=4 and container_guid = 585986 and site_guid = 1 and ( (access_id IN (2)
OR (owner_guid = -1)
OR (
access_id = 0
AND owner_guid = -1
)
) and enabled='yes') and 1=1 ORDER BY time_created desc