Акции и скидки

MySQL Query Error: SELECT CAT_P1.PRICE as CATALOG_PRICE_1 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 LEFT JOIN b_catalog_price CAT_P1 ON (CAT_P1.PRODUCT_ID = BE.ID AND CAT_P1.CATALOG_GROUP_ID = 1) 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_iblock_element_prop_s20 P20 on (( P20.IBLOCK_ELEMENT_ID = BE.ID )) WHERE 1=1 AND ( ((((BE.ACTIVE='Y')))) ) AND (( BE.IBLOCK_ID = 20 )) AND (((BE.WF_STATUS_ID=1 AND BE.WF_PARENT_ELEMENT_ID IS NULL))) AND (( CAT_PR.QUANTITY > 0 )) and (( P20.PROPERTY_90 IN ( SELECT DISTINCT BEX.ID as ID FROM b_iblock_element BEX INNER JOIN b_iblock_section BSubS ON BEX.IBLOCK_SECTION_ID = BSubS.ID INNER JOIN b_iblock_section BS ON (BSubS.IBLOCK_ID=BS.IBLOCK_ID AND BSubS.LEFT_MARGIN>=BS.LEFT_MARGIN AND BSubS.RIGHT_MARGIN<=BS.RIGHT_MARGIN) WHERE ((BS.ID= AND BEX.IBLOCK_ID = 18 AND BS.ACTIVE='Y')) ) )) ORDER BY CAT_P1.PRICE asc LIMIT 1 [You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AND BEX.IBLOCK_ID = 18 AND BS.ACTIVE='Y')) ) )) ORDER BY CAT_P1.PRICE asc LIM' at line 26]

DB query error.
Please try later.