MySQL Query Error: SELECT BE.IBLOCK_ID as IBLOCK_ID,BE.ID as ID,BE.NAME as NAME,BE.DETAIL_PICTURE as DETAIL_PICTURE, FPEN0.VALUE as PROPERTY_BRAND_VALUE, FPEN0.ID as PROPERTY_BRAND_ENUM_ID, FPV1.ID as PROPERTY_BRAND_VALUE_ID, FPV2.VALUE as PROPERTY_CML2_BAR_CODE_VALUE, FPV2.ID as PROPERTY_CML2_BAR_CODE_VALUE_ID, FPV0.VALUE as PROPERTY_SKLAD_VALUE, FPV0.ID as PROPERTY_SKLAD_VALUE_ID , CAT_P2.ID as CATALOG_PRICE_ID_2, CAT_P2.CATALOG_GROUP_ID as CATALOG_GROUP_ID_2, CAT_P2.PRICE as CATALOG_PRICE_2, CAT_P2.CURRENCY as CATALOG_CURRENCY_2, CAT_P2.QUANTITY_FROM as CATALOG_QUANTITY_FROM_2, CAT_P2.QUANTITY_TO as CATALOG_QUANTITY_TO_2, '' as CATALOG_GROUP_NAME_2, 'Y' as CATALOG_CAN_ACCESS_2, 'Y' as CATALOG_CAN_BUY_2, CAT_P2.EXTRA_ID as CATALOG_EXTRA_ID_2, CAT_PR.QUANTITY as CATALOG_QUANTITY, IF (CAT_PR.QUANTITY_TRACE = 'D', 'Y', CAT_PR.QUANTITY_TRACE) as CATALOG_QUANTITY_TRACE, CAT_PR.QUANTITY_TRACE as CATALOG_QUANTITY_TRACE_ORIG, IF (CAT_PR.CAN_BUY_ZERO = 'D', 'Y', CAT_PR.CAN_BUY_ZERO) as CATALOG_CAN_BUY_ZERO, IF (CAT_PR.NEGATIVE_AMOUNT_TRACE = 'D', 'Y', CAT_PR.NEGATIVE_AMOUNT_TRACE) as CATALOG_NEGATIVE_AMOUNT_TRACE, IF (CAT_PR.SUBSCRIBE = 'D', 'Y', CAT_PR.SUBSCRIBE) as CATALOG_SUBSCRIBE, IF (
CAT_PR.QUANTITY > 0 OR
IF (CAT_PR.QUANTITY_TRACE = 'D', 'Y', CAT_PR.QUANTITY_TRACE) = 'N' OR
IF (CAT_PR.CAN_BUY_ZERO = 'D', 'Y', CAT_PR.CAN_BUY_ZERO) = 'Y',
'Y', 'N'
) as CATALOG_AVAILABLE, CAT_PR.WEIGHT as CATALOG_WEIGHT, CAT_PR.WIDTH as CATALOG_WIDTH, CAT_PR.LENGTH as CATALOG_LENGTH, CAT_PR.HEIGHT as CATALOG_HEIGHT, CAT_PR.MEASURE as CATALOG_MEASURE, CAT_VAT.RATE as CATALOG_VAT, CAT_PR.VAT_INCLUDED as CATALOG_VAT_INCLUDED, CAT_PR.PRICE_TYPE as CATALOG_PRICE_TYPE, CAT_PR.RECUR_SCHEME_TYPE as CATALOG_RECUR_SCHEME_TYPE, CAT_PR.RECUR_SCHEME_LENGTH as CATALOG_RECUR_SCHEME_LENGTH, CAT_PR.TRIAL_PRICE_ID as CATALOG_TRIAL_PRICE_ID, CAT_PR.WITHOUT_ORDER as CATALOG_WITHOUT_ORDER, CAT_PR.SELECT_BEST_PRICE as CATALOG_SELECT_BEST_PRICE, CAT_PR.PURCHASING_PRICE as CATALOG_PURCHASING_PRICE, CAT_PR.PURCHASING_CURRENCY as CATALOG_PURCHASING_CURRENCY, CAT_PR.TYPE as CATALOG_TYPE
FROM
b_iblock B
INNER JOIN b_lang L ON B.LID=L.LID
INNER JOIN b_iblock_element BE ON BE.IBLOCK_ID = B.ID
INNER JOIN b_iblock_property FP0 ON FP0.IBLOCK_ID = B.ID AND FP0.CODE='SKLAD'
LEFT JOIN b_iblock_property FP1 ON FP1.IBLOCK_ID = B.ID AND FP1.CODE='BRAND'
LEFT JOIN b_iblock_property FP2 ON FP2.IBLOCK_ID = B.ID AND FP2.CODE='CML2_BAR_CODE'
INNER JOIN b_iblock_element_property FPV0 ON FPV0.IBLOCK_PROPERTY_ID = FP0.ID AND FPV0.IBLOCK_ELEMENT_ID = BE.ID
LEFT JOIN b_iblock_element_property FPV1 ON FPV1.IBLOCK_PROPERTY_ID = FP1.ID AND FPV1.IBLOCK_ELEMENT_ID = BE.ID
LEFT JOIN b_iblock_element_property FPV2 ON FPV2.IBLOCK_PROPERTY_ID = FP2.ID AND FPV2.IBLOCK_ELEMENT_ID = BE.ID
LEFT JOIN b_iblock_property_enum FPEN0 ON FPEN0.PROPERTY_ID = FPV1.IBLOCK_PROPERTY_ID AND FPV1.VALUE_ENUM = FPEN0.ID
INNER JOIN (
SELECT DISTINCT BSE.IBLOCK_ELEMENT_ID
FROM b_iblock_section_element BSE
INNER JOIN b_iblock_section BS ON BSE.IBLOCK_SECTION_ID = BS.ID
WHERE ((BS.ID IN (715, 634, 713, 683)))
) BES ON BES.IBLOCK_ELEMENT_ID = BE.ID
LEFT JOIN b_catalog_price CAT_P2 ON (CAT_P2.PRODUCT_ID = BE.ID AND CAT_P2.CATALOG_GROUP_ID = 2)
LEFT JOIN b_catalog_product CAT_PR ON (CAT_PR.ID = BE.ID)
LEFT JOIN b_catalog_iblock CAT_IB ON ((CAT_PR.VAT_ID IS NULL OR CAT_PR.VAT_ID = 0) AND CAT_IB.IBLOCK_ID = BE.IBLOCK_ID)
LEFT JOIN b_catalog_vat CAT_VAT ON (CAT_VAT.ID = IF((CAT_PR.VAT_ID IS NULL OR CAT_PR.VAT_ID = 0), CAT_IB.VAT_ID, CAT_PR.VAT_ID))
WHERE 1=1
AND (
((((BE.IBLOCK_ID = '13'))))
AND ((((CAT_P2.PRICE > '1'))))
AND ((((FPV0.VALUE >= '1'))))
)
AND (((BE.WF_STATUS_ID=1 AND BE.WF_PARENT_ELEMENT_ID IS NULL)))
ORDER BY FPV0.VALUE desc LIMIT 0, 16[Lost connection to MySQL server during query]