MySQL Query Error: SELECT DISTINCT BE.*, DATE_FORMAT(BE.TIMESTAMP_X, '%d.%m.%Y %H:%i:%s') as TIMESTAMP_X, DATE_FORMAT(BE.ACTIVE_FROM, '%d.%m.%Y %H:%i:%s') as ACTIVE_FROM, DATE_FORMAT(BE.ACTIVE_TO, '%d.%m.%Y %H:%i:%s') as ACTIVE_TO, L.DIR as LANG_DIR, B.DETAIL_PAGE_URL, B.LIST_PAGE_URL, B.LID, L.SERVER_NAME FROM b_iblock_element BE, b_lang L, b_iblock B LEFT JOIN b_iblock_group IBG ON IBG.IBLOCK_ID=B.ID WHERE BE.IBLOCK_ID = B.ID AND B.LID = L.LID AND IBG.GROUP_ID IN (2) AND BE.WF_STATUS_ID = 1 AND BE.WF_PARENT_ELEMENT_ID is null AND IBG.PERMISSION>='R' AND (IBG.PERMISSION='X' OR B.ACTIVE='Y') AND (BE.IBLOCK_ID = 33) AND ((BE.ACTIVE_TO >= now() OR BE.ACTIVE_TO IS NULL) AND (BE.ACTIVE_FROM <= now() OR BE.ACTIVE_FROM IS NULL)) AND (BE.ACTIVE = 'Y') AND (BE.ACTIVE_FROM>='2007-01-31 17:12:20' OR BE.ACTIVE_FROM IS NULL) ORDER BY BE.ACTIVE_FROM DESC, BE.SORT ASC [Out of memory; restart server and try again (needed 65528 bytes)]