SELECT
product.productid,
product.product_code,
product.product_thumb,
product.product_image,
product.product_detail,
product.categories,
product.product_type,
product.product_status,
product_size.remain,
product_size.size_productid,
SUM(remain) as total
FROM
product ,
product_size
where product.productid=product_size.size_productid and product.categories=29 GROUP BY product.productid