Error Number: 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 'ON-BL LIMIT 1' at line 8
SELECT p.*,b.code_sap as producto_marca,(select url from image i where p.product_id=i.product_id order by image_id desc LIMIT 1) as url,b.name as ItmsGrpNam,prc.price,prc.currency,s.stock,s.stock_u,b.url_products,b.image as img_default,ncm_code,p.leadtime ,IF((select discount from discount d inner join prefix px on d.type_id=px.prefix_id where p.code_sap like (concat(px.prefix,'%') COLLATE utf8_unicode_ci) and px.brand_id=p.brand_id order by discount asc Limit 1)is null,0,(select discount from discount d inner join prefix px on d.type_id=px.prefix_id where p.code_sap like (concat(px.prefix,'%') COLLATE utf8_unicode_ci) and px.brand_id=p.brand_id order by discount asc Limit 1)) as discount_prefix FROM product p inner join brand b on p.brand_id=b.brand_id left join price prc ON p.product_id=prc.product_id left join stock s ON p.product_id=s.product_id WHERE p.status = 'ACTIVO' AND b.status = 'ACTIVO' AND p.product_id=MX-OPT-BOX-2-EXT-ON-BL LIMIT 1
Filename: models/store/Products_model.php
Line Number: 925