SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') GROUP by op.grp_id ORDER by o.dt_insert DESC LIMIT 0,15' at line 11 at /var/www/opt/data/www/opt.auto-help.ru/adm/lib/php/cms_sql/class_order.php line 110
Array
(
    [code] => 1064
    [message] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')		
		GROUP by op.grp_id
		ORDER by o.dt_insert DESC LIMIT 0,15' at line 11
    [query] => 
		SELECT op.1c_id, op.grp_id, o.id as order_id, DATE_FORMAT(o.dt_insert,'%d.%m.%Y %H:%i') as dt, DATE_FORMAT(o.dt_delivery,'%d.%m') as dt_delivery, o.memo,
		(SELECT round(sum(orderproduct.price*orderproduct.cnt)/100,2) from cms_order_product orderproduct LEFT JOIN cms_order ord ON orderproduct.order_id = ord.id WHERE orderproduct.grp_id=op.grp_id and ord.user_id=NULL) as sum,
		IF (o.addr_id>0,(SELECT name from cms_user_addr WHERE id=o.addr_id),'самовывоз') as address,
		IF ((SELECT count(*) from cms_order_product orderproduct LEFT JOIN cms_order ord ON orderproduct.order_id = ord.id WHERE orderproduct.grp_id=op.grp_id and ord.user_id=NULL)=1,(SELECT product.article from cms_order_product orderproduct LEFT JOIN cms_order ord ON orderproduct.order_id = ord.id LEFT JOIN cms_product product ON orderproduct.product_id = product.id WHERE orderproduct.grp_id=op.grp_id and ord.user_id=NULL),(SELECT count(*) from cms_order_product orderproduct LEFT JOIN cms_order ord ON orderproduct.order_id = ord.id WHERE orderproduct.grp_id=op.grp_id and ord.user_id=NULL)) as article,
		(SELECT sum(orderproduct.cnt) from cms_order_product orderproduct LEFT JOIN cms_order ord ON orderproduct.order_id = ord.id WHERE orderproduct.grp_id=op.grp_id and ord.user_id=NULL) as article_cnt,
		IF ((SELECT count(*) from cms_order_product orderproduct LEFT JOIN cms_order ord ON orderproduct.order_id = ord.id WHERE orderproduct.grp_id=op.grp_id and ord.user_id=NULL)=1,(SELECT product.name from cms_order_product orderproduct LEFT JOIN cms_order ord ON orderproduct.order_id = ord.id LEFT JOIN cms_product product ON orderproduct.product_id = product.id WHERE orderproduct.grp_id=op.grp_id and ord.user_id=NULL),'') as product_name,
		(SELECT count(*) from cms_order_product orderproduct LEFT JOIN cms_order ord ON orderproduct.order_id = ord.id WHERE orderproduct.grp_id=op.grp_id and ord.user_id=NULL) as prod_cnt		
		FROM cms_order_product op 
		LEFT JOIN cms_order o ON op.order_id = o.id 
		LEFT JOIN cms_product prod ON op.product_id = prod.id 
		WHERE TRUE AND (o.user_id=)		
		GROUP by op.grp_id
		ORDER by o.dt_insert DESC LIMIT 0,15
		
    [context] => /var/www/opt/data/www/opt.auto-help.ru/adm/lib/php/cms_sql/class_order.php line 110
)