SELECT DISTINCT( SUBSTRING_INDEX(reference, '.', 1) ) AS reference FROM prstshp_product_attribute pa LEFT JOIN prstshp_stock_available sa ON sa.id_product = pa.id_product AND sa.id_product_attribute = pa.id_product_attribute WHERE pa.id_product = 243 AND sa.quantity > 0
There is 1 product.