1064 - 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 '. substr(select pd.products_name, p.products_image, p.products_id, SUBSTRING...' at line 1
INSERT INTO `aaalogging` (`id`, `name`, `description`, `description2`, `line`, `date`) VALUES (NULL, '', '', 'select count(p.products_id) as total ' . substr(select pd.products_name, p.products_image, p.products_id, SUBSTRING_INDEX(pd.products_description, ' ', 20) as products_description, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price, p.products_quantity as in_stock, if(s.status, 1, 0) as is_special, p.products_status_tobesold, p.products_qty_blocks from products p left join products_description pd on (p.products_id = pd.products_id) left join products_to_categories p2c on (p.products_id = p2c.products_id) left join products_freefields pf on (p.products_id = pf.products_id) left join manufacturers m on (p.manufacturers_id = m.manufacturers_id) left join specials s on (p.products_id = s.products_id) where p.products_status = '1' and pd.language_id = '4' and p2c.categories_id = '19673' order by pd.products_name, 473, (917 - 473))', '38', now())