SELECT DISTINCT BS. * , BS.XML_ID AS EXTERNAL_ID, DATE_FORMAT( BS.TIMESTAMP_X, '%d.%m.%Y %H:%i:%s' ) AS TIMESTAMP_X, COUNT( DISTINCT BE.ID ) AS ELEMENT_CNT
FROM b_iblock_section BS, b_iblock B
LEFT JOIN b_iblock_group IBG ON IBG.IBLOCK_ID = B.ID, b_iblock_section BSTEMP
LEFT JOIN b_iblock_section_element BSE ON BSE.IBLOCK_SECTION_ID = BSTEMP.ID
LEFT JOIN b_iblock_element BE ON ( BSE.IBLOCK_ELEMENT_ID = BE.ID
AND (
(
BE.WF_STATUS_ID =1
AND BE.WF_PARENT_ELEMENT_ID IS NULL
)
AND BE.IBLOCK_ID = BS.IBLOCK_ID )
)
WHERE BS.IBLOCK_ID = B.ID
AND BSTEMP.IBLOCK_ID = BS.IBLOCK_ID
AND BSTEMP.LEFT_MARGIN >= BS.LEFT_MARGIN
AND BSTEMP.RIGHT_MARGIN <= BS.RIGHT_MARGIN
AND (
(
(
(
BS.IBLOCK_ID = '48'
)
)
)
)
AND (
(
(
(
BS.IBLOCK_SECTION_ID = '985'
)
)
)
)
GROUP BY BS.ID
ORDER BY BS.TIMESTAMP_X DESC
LIMIT 0 , 30
Ответ MySQL:
#1053 - Server shutdown in progress |