SELECT COUNT(DISTINCT BE.ID) as C 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 FP1 ON FP1.IBLOCK_ID=B.ID AND FP1.CODE='adress' INNER JOIN b_iblock_element_property FPV1 ON FP1.ID=FPV1.IBLOCK_PROPERTY_ID AND FPV1.IBLOCK_ELEMENT_ID=BE.ID INNER JOIN b_iblock_property FP2 ON FP2.IBLOCK_ID=B.ID AND FP2.CODE='phone' INNER JOIN b_iblock_element_property FPV2 ON FP2.ID=FPV2.IBLOCK_PROPERTY_ID AND FPV2.IBLOCK_ELEMENT_ID=BE.ID INNER JOIN b_iblock_property FP3 ON FP3.IBLOCK_ID=B.ID AND FP3.CODE='fax' INNER JOIN b_iblock_element_property FPV3 ON FP3.ID=FPV3.IBLOCK_PROPERTY_ID AND FPV3.IBLOCK_ELEMENT_ID=BE.ID INNER JOIN b_iblock_property FP4 ON FP4.IBLOCK_ID=B.ID AND FP4.CODE='site' INNER JOIN b_iblock_element_property FPV4 ON FP4.ID=FPV4.IBLOCK_PROPERTY_ID AND FPV4.IBLOCK_ELEMENT_ID=BE.ID INNER JOIN b_iblock_property FP5 ON FP5.IBLOCK_ID=B.ID AND FP5.CODE='mail' INNER JOIN b_iblock_element_property FPV5 ON FP5.ID=FPV5.IBLOCK_PROPERTY_ID AND FPV5.IBLOCK_ELEMENT_ID=BE.ID INNER JOIN b_iblock_property FP6 ON FP6.IBLOCK_ID=B.ID AND FP6.CODE='vid' INNER JOIN b_iblock_element_property FPV6 ON FP6.ID=FPV6.IBLOCK_PROPERTY_ID AND FPV6.IBLOCK_ELEMENT_ID=BE.ID INNER JOIN b_iblock_property FP7 ON FP7.IBLOCK_ID=B.ID AND FP7.CODE='tag' INNER JOIN b_iblock_element_property FPV7 ON FP7.ID=FPV7.IBLOCK_PROPERTY_ID AND FPV7.IBLOCK_ELEMENT_ID=BE.ID INNER JOIN b_iblock_property FP8 ON FP8.IBLOCK_ID=B.ID AND FP8.CODE='dni' INNER JOIN b_iblock_element_property FPV8 ON FP8.ID=FPV8.IBLOCK_PROPERTY_ID AND FPV8.IBLOCK_ELEMENT_ID=BE.ID INNER JOIN b_iblock_property FP9 ON FP9.IBLOCK_ID=B.ID AND FP9.CODE='work' INNER JOIN b_iblock_element_property FPV9 ON FP9.ID=FPV9.IBLOCK_PROPERTY_ID AND FPV9.IBLOCK_ELEMENT_ID=BE.ID INNER JOIN b_iblock_property FP10 ON FP10.IBLOCK_ID=B.ID AND FP10.CODE='ruk' INNER JOIN b_iblock_element_property FPV10 ON FP10.ID=FPV10.IBLOCK_PROPERTY_ID AND FPV10.IBLOCK_ELEMENT_ID=BE.ID INNER JOIN b_iblock_property FP11 ON FP11.IBLOCK_ID=B.ID AND FP11.CODE='link' INNER JOIN b_iblock_element_property FPV11 ON FP11.ID=FPV11.IBLOCK_PROPERTY_ID AND FPV11.IBLOCK_ELEMENT_ID=BE.ID INNER JOIN b_iblock_property_enum FPEN11 ON FP11.ID = FPEN11.PROPERTY_ID AND FPV11.VALUE_ENUM=FPEN11.ID WHERE 1=1 AND B.ID IN (0,86) AND ( (BE.WF_STATUS_ID=1 AND BE.WF_PARENT_ELEMENT_ID IS NULL) ) AND ((((BE.IBLOCK_ID = '86')))) AND ((((BE.ACTIVE='Y')))) AND (((BE.ACTIVE_TO >= now() OR BE.ACTIVE_TO IS NULL) AND (BE.ACTIVE_FROM <= now() OR BE.ACTIVE_FROM IS NULL))) AND ((((
(upper(BE.NAME) like upper('%0%') and BE.NAME is not null)
)))) AND ((((
(upper(FPV1.VALUE) like upper('%0%') and FPV1.VALUE is not null)
)))) AND ((((
(upper(FPV2.VALUE) like upper('%0%') and FPV2.VALUE is not null)
)))) AND ((((
(upper(FPV3.VALUE) like upper('%0%') and FPV3.VALUE is not null)
)))) AND ((((
(upper(FPV4.VALUE) like upper('%0%') and FPV4.VALUE is not null)
)))) AND ((((
(upper(FPV5.VALUE) like upper('%0%') and FPV5.VALUE is not null)
)))) AND ((((
(upper(FPV6.VALUE) like upper('%0%') and FPV6.VALUE is not null)
)))) AND ((((
(upper(FPV7.VALUE) like upper('%0%') and FPV7.VALUE is not null)
)))) AND ((((
(upper(FPV8.VALUE) like upper('%0%') and FPV8.VALUE is not null)
)))) AND ((((
(upper(FPV9.VALUE) like upper('%0\'\"><a%') and FPV9.VALUE is not null)
AND
(upper(FPV9.VALUE) like upper('%href=http://80x08.ru>x</a><%') and FPV9.VALUE is not null)
)))) AND ((((
(upper(FPV10.VALUE) like upper('%0%') and FPV10.VALUE is not null)
)))) AND ((((FPEN11.ID = '0')))); |