I'm somehow not contented with my query statement and am wondering if there are other better way to do this:
SELECT product.product,
COALESCE((SELECT SUM(qty) FROM stocktrxn
INNER JOIN stock on stock.tra_no = stocktrxn.tra_no
WHERE product_no = s1.product_no and stock.is_out = false) -
(SELECT SUM(qty) FROM stocktrxn
INNER JOIN stock on stock.tra_no = stocktrxn.tra_no
WHERE product_no = s1.product_no and stock.is_out = true), 0)
as qty
FROM stocktrxn s1
RIGHT JOIN product on product.id = s1.product_no
GROUP BY product ASC;