SELECT distinct ptype.id type_id, pc.country_id, Product.name, ProductImage.path,ProductImage.id id_image, Product.id id_producto
FROM products Product
INNER JOIN products_images ProductImage ON(Product.id = ProductImage.product)
INNER JOIN products_products_type pptype on (Product.id=pptype.product)
INNER JOIN products_types ptype on (pptype.product_type=ptype.id)
LEFT JOIN products_countries pc on (Product.id=pc.product_id)
WHERE ProductImage.language = 'es' and pc.country_id = ''and active=1 AND ProductImage.category =0 and
(pc.country_id='' or pc.country_id is null ) order by Product.score asc