[Bitrix\Main\DB\SqlQueryException] 
Mysql query error: (0)  (400)
SELECT 
	`sale_internals_order`.`ID` AS `ID`,
	`sale_internals_order`.`LID` AS `LID`,
	`sale_internals_order`.`ACCOUNT_NUMBER` AS `ACCOUNT_NUMBER`,
	`sale_internals_order`.`TRACKING_NUMBER` AS `TRACKING_NUMBER`,
	`sale_internals_order`.`PAY_SYSTEM_ID` AS `PAY_SYSTEM_ID`,
	`sale_internals_order`.`DELIVERY_ID` AS `DELIVERY_ID`,
	`sale_internals_order`.`DATE_INSERT` AS `DATE_INSERT`,
	`sale_internals_order`.`DATE_UPDATE` AS `DATE_UPDATE`,
	`sale_internals_order`.`PERSON_TYPE_ID` AS `PERSON_TYPE_ID`,
	`sale_internals_order`.`USER_ID` AS `USER_ID`,
	`sale_internals_order`.`PAYED` AS `PAYED`,
	`sale_internals_order`.`DATE_PAYED` AS `DATE_PAYED`,
	`sale_internals_order`.`EMP_PAYED_ID` AS `EMP_PAYED_ID`,
	`sale_internals_order`.`DEDUCTED` AS `DEDUCTED`,
	`sale_internals_order`.`DATE_DEDUCTED` AS `DATE_DEDUCTED`,
	`sale_internals_order`.`EMP_DEDUCTED_ID` AS `EMP_DEDUCTED_ID`,
	`sale_internals_order`.`REASON_UNDO_DEDUCTED` AS `REASON_UNDO_DEDUCTED`,
	`sale_internals_order`.`STATUS_ID` AS `STATUS_ID`,
	`sale_internals_order`.`DATE_STATUS` AS `DATE_STATUS`,
	`sale_internals_order`.`EMP_STATUS_ID` AS `EMP_STATUS_ID`,
	`sale_internals_order`.`MARKED` AS `MARKED`,
	`sale_internals_order`.`DATE_MARKED` AS `DATE_MARKED`,
	`sale_internals_order`.`EMP_MARKED_ID` AS `EMP_MARKED_ID`,
	`sale_internals_order`.`REASON_MARKED` AS `REASON_MARKED`,
	`sale_internals_order`.`PRICE_DELIVERY` AS `PRICE_DELIVERY`,
	`sale_internals_order`.`ALLOW_DELIVERY` AS `ALLOW_DELIVERY`,
	`sale_internals_order`.`DATE_ALLOW_DELIVERY` AS `DATE_ALLOW_DELIVERY`,
	`sale_internals_order`.`EMP_ALLOW_DELIVERY_ID` AS `EMP_ALLOW_DELIVERY_ID`,
	`sale_internals_order`.`RESERVED` AS `RESERVED`,
	`sale_internals_order`.`PRICE` AS `PRICE`,
	`sale_internals_order`.`CURRENCY` AS `CURRENCY`,
	`sale_internals_order`.`DISCOUNT_VALUE` AS `DISCOUNT_VALUE`,
	`sale_internals_order`.`TAX_VALUE` AS `TAX_VALUE`,
	`sale_internals_order`.`SUM_PAID` AS `SUM_PAID`,
	`sale_internals_order`.`USER_DESCRIPTION` AS `USER_DESCRIPTION`,
	`sale_internals_order`.`PAY_VOUCHER_NUM` AS `PAY_VOUCHER_NUM`,
	`sale_internals_order`.`PAY_VOUCHER_DATE` AS `PAY_VOUCHER_DATE`,
	`sale_internals_order`.`ADDITIONAL_INFO` AS `ADDITIONAL_INFO`,
	`sale_internals_order`.`COMMENTS` AS `COMMENTS`,
	`sale_internals_order`.`COMPANY_ID` AS `COMPANY_ID`,
	`sale_internals_order`.`CREATED_BY` AS `CREATED_BY`,
	`sale_internals_order`.`RESPONSIBLE_ID` AS `RESPONSIBLE_ID`,
	`sale_internals_order`.`STAT_GID` AS `STAT_GID`,
	`sale_internals_order`.`DATE_PAY_BEFORE` AS `DATE_PAY_BEFORE`,
	`sale_internals_order`.`DATE_BILL` AS `DATE_BILL`,
	`sale_internals_order`.`IS_RECURRING` AS `IS_RECURRING`,
	`sale_internals_order`.`RECURRING_ID` AS `RECURRING_ID`,
	`sale_internals_order`.`LOCKED_BY` AS `LOCKED_BY`,
	`sale_internals_order`.`DATE_LOCK` AS `DATE_LOCK`,
	`sale_internals_order`.`RECOUNT_FLAG` AS `RECOUNT_FLAG`,
	`sale_internals_order`.`AFFILIATE_ID` AS `AFFILIATE_ID`,
	`sale_internals_order`.`DELIVERY_DOC_NUM` AS `DELIVERY_DOC_NUM`,
	`sale_internals_order`.`DELIVERY_DOC_DATE` AS `DELIVERY_DOC_DATE`,
	`sale_internals_order`.`UPDATED_1C` AS `UPDATED_1C`,
	`sale_internals_order`.`ORDER_TOPIC` AS `ORDER_TOPIC`,
	`sale_internals_order`.`XML_ID` AS `XML_ID`,
	`sale_internals_order`.`ID_1C` AS `ID_1C`,
	`sale_internals_order`.`VERSION_1C` AS `VERSION_1C`,
	`sale_internals_order`.`VERSION` AS `VERSION`,
	`sale_internals_order`.`EXTERNAL_ORDER` AS `EXTERNAL_ORDER`,
	`sale_internals_order`.`STORE_ID` AS `STORE_ID`,
	`sale_internals_order`.`CANCELED` AS `CANCELED`,
	`sale_internals_order`.`EMP_CANCELED_ID` AS `EMP_CANCELED_ID`,
	`sale_internals_order`.`DATE_CANCELED` AS `DATE_CANCELED`,
	`sale_internals_order`.`REASON_CANCELED` AS `REASON_CANCELED`,
	`sale_internals_order`.`BX_USER_ID` AS `BX_USER_ID`,
	`sale_internals_order`.`RUNNING` AS `RUNNING`,
	DATE_FORMAT(`sale_internals_order`.`DATE_INSERT`, '%d.%m.%Y %H:%i:%s') AS `DATE_INSERT_FORMAT`,
	DATE(`sale_internals_order`.`DATE_UPDATE`) AS `DATE_UPDATE_SHORT`,
	DATE(`sale_internals_order`.`DATE_STATUS`) AS `DATE_STATUS_SHORT`,
	DATE(`sale_internals_order`.`DATE_CANCELED`) AS `DATE_CANCELED_SHORT`,
	(SELECT (CASE WHEN MAX(BR.RECOMMENDATION) IS NULL OR MAX(BR.RECOMMENDATION) = '' THEN 'N' ELSE 'Y' END) FROM b_sale_basket BR WHERE BR.ORDER_ID=`sale_internals_order`.`ID` GROUP BY BR.ORDER_ID) AS `BY_RECOMMENDATION`,
	if(DATE_LOCK is null, 'green', if(DATE_ADD(DATE_LOCK, interval 30 MINUTE)<now(), 'green', if(LOCKED_BY=0, 'yellow', 'red'))) AS `LOCK_STATUS`,
	CONCAT('(', `sale_internals_order_lock_user`.`LOGIN`, ') ', `sale_internals_order_lock_user`.`NAME`, ' ', `sale_internals_order_lock_user`.`LAST_NAME`) AS `LOCK_USER_NAME`,
	`sale_internals_order_responsible`.`LOGIN` AS `RESPONSIBLE_LOGIN`,
	`sale_internals_order_responsible`.`NAME` AS `RESPONSIBLE_NAME`,
	`sale_internals_order_responsible`.`LAST_NAME` AS `RESPONSIBLE_LAST_NAME`,
	`sale_internals_order_responsible`.`SECOND_NAME` AS `RESPONSIBLE_SECOND_NAME`,
	`sale_internals_order_responsible`.`EMAIL` AS `RESPONSIBLE_EMAIL`,
	`sale_internals_order_responsible`.`WORK_POSITION` AS `RESPONSIBLE_WORK_POSITION`,
	`sale_internals_order_responsible`.`PERSONAL_PHOTO` AS `RESPONSIBLE_PERSONAL_PHOTO`,
	`sale_internals_order_user`.`LOGIN` AS `USER_LOGIN`,
	`sale_internals_order_user`.`NAME` AS `USER_NAME`,
	`sale_internals_order_user`.`LAST_NAME` AS `USER_LAST_NAME`,
	`sale_internals_order_user`.`EMAIL` AS `USER_EMAIL`
FROM `b_sale_order` `sale_internals_order` 
LEFT JOIN `b_user` `sale_internals_order_lock_user` ON `sale_internals_order`.`LOCKED_BY` = `sale_internals_order_lock_user`.`ID`
LEFT JOIN `b_user` `sale_internals_order_responsible` ON `sale_internals_order`.`RESPONSIBLE_ID` = `sale_internals_order_responsible`.`ID`
INNER JOIN `b_user` `sale_internals_order_user` ON `sale_internals_order`.`USER_ID` = `sale_internals_order_user`.`ID`
WHERE `sale_internals_order`.`CANCELED` = 'N'
/var/www/lrservice-shop/data/www/lrservice-shop.ru/bitrix/modules/main/lib/db/mysqliconnection.php:137
#0: Bitrix\Main\DB\MysqliConnection->queryInternal(string, array, NULL)
	/var/www/lrservice-shop/data/www/lrservice-shop.ru/bitrix/modules/main/lib/db/connection.php:330
#1: Bitrix\Main\DB\Connection->query(string)
	/var/www/lrservice-shop/data/www/lrservice-shop.ru/bitrix/modules/main/lib/entity/query.php:3038
#2: Bitrix\Main\Entity\Query->query(string)
	/var/www/lrservice-shop/data/www/lrservice-shop.ru/bitrix/modules/main/lib/entity/query.php:797
#3: Bitrix\Main\Entity\Query->exec()
	/var/www/lrservice-shop/data/www/lrservice-shop.ru/bitrix/modules/sale/lib/compatible/compatible.php:593
#4: Bitrix\Sale\Compatible\OrderQuery->compatibleExec(object, NULL)
	/var/www/lrservice-shop/data/www/lrservice-shop.ru/bitrix/modules/sale/lib/compatible/internals/entitycompatibility.php:476
#5: Bitrix\Sale\Compatible\Internals\EntityCompatibility->execute()
	/var/www/lrservice-shop/data/www/lrservice-shop.ru/bitrix/modules/sale/lib/compatible/internals/entitycompatibility.php:150
#6: Bitrix\Sale\Compatible\Internals\EntityCompatibility::setGetListParameters(object, array, array, boolean, boolean, array, boolean)
	/var/www/lrservice-shop/data/www/lrservice-shop.ru/bitrix/modules/sale/lib/compatible/internals/entitycompatibility.php:98
#7: Bitrix\Sale\Compatible\Internals\EntityCompatibility::getList(array, array, boolean, boolean, array, boolean)
	/var/www/lrservice-shop/data/www/lrservice-shop.ru/bitrix/modules/sale/mysql/order.php:492
#8: CSaleOrder::GetList(array, array)
	/var/www/lrservice-shop/data/www/lrservice-shop.ru/bitrix/php_interface/init.php:472
#9: promoteUsersToDiscountGroup()
	/var/www/lrservice-shop/data/www/lrservice-shop.ru/bitrix/php_interface/init.php:529
#10: include_once(string)
	/var/www/lrservice-shop/data/www/lrservice-shop.ru/bitrix/modules/main/include.php:234
#11: require_once(string)
	/var/www/lrservice-shop/data/www/lrservice-shop.ru/bitrix/modules/main/include/prolog_before.php:14
#12: require_once(string)
	/var/www/lrservice-shop/data/www/lrservice-shop.ru/bitrix/modules/main/include/prolog.php:10
#13: require_once(string)
	/var/www/lrservice-shop/data/www/lrservice-shop.ru/bitrix/header.php:1
#14: require(string)
	/var/www/lrservice-shop/data/www/lrservice-shop.ru/catalog/index.php:2
#15: include_once(string)
	/var/www/lrservice-shop/data/www/lrservice-shop.ru/bitrix/modules/main/include/urlrewrite.php:159
#16: include_once(string)
	/var/www/lrservice-shop/data/www/lrservice-shop.ru/bitrix/urlrewrite.php:2