1С-Битрикс
3
Вклад в тег
->where([
["UF_ACTIVE", "=", 1],
["UF_ELEMENT_ID", "=", $arFields["ID"]],
])
->whereColumn('UF_CREATED_BY',"!=", 'UF_USER_ID')
->where(\Bitrix\Main\Entity\Query::filter()
->logic('or')
->where([
['UF_DATE_ACTIVE', "<=", mktime(23,59,59,date("m"),date("d")+1,date("Y"))],
['UF_DATE_ACTIVE', "=", null],
]))
SELECT
COUNT(*) AS `CNT`
FROM `table` `table`
WHERE
`table`.`UF_ACTIVE` = 1
AND
`table`.`UF_ELEMENT_ID` = 1
AND
`table`.`UF_CREATED_BY` <> `table`.`UF_USER_ID`
AND
(`table`.`UF_DATE_ACTIVE` <= 1678568399 OR `table`.`UF_DATE_ACTIVE` IS NULL)