- Unknown column 'p.valor_desconto' in 'field list'
select p.products_image, pd.products_name, p.products_id, p.products_price, p.valor_desconto, 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, parcelas, categories_name, cd.categories_id, p.products_quantity, rw_titulo_1, tipo_produto from products_description pd, products p left join specials s on p.products_id = s.products_id, products_to_categories p2c left join categories_description cd on cd.categories_id=p2c.categories_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and p2c.categories_id = '365' group by p.products_id order by if(p.products_quantity>0, 1, if(p.prazo_entrega>0, 1, 0)) desc, p.products_ordered desc, products_id asc