Here is my first query
SELECT
tax_productid,
CONCAT(GROUP_CONCAT(tax_code SEPARATOR " "), " ", sum(tax_iva), "%") AS tax
FROM tb_tax t group by tax_productid order by tax_productid, prd_type desc;
which returns a proper tax applied on product (multiple tax type may applied on single product)
output data like.
tax_productid tax
=========================
1 tax1 tax2 10%
2 tax1 tax2 20%
3 tax1 tax2 30%
now there is a another table product and query is like
SELECT * FROM product ORDER BY productName;
return 10 product records.
I want to get product wise tax list but if there is no tax show null
SELECT
t1.*,
CONCAT(GROUP_CONCAT(tax_code SEPARATOR " "), " ", sum(tax_iva), "%") AS tax
FROM
product t1, tb_tax t2
WHERE
t2.tax_product = t1.id;
this query returns only 3 rows. I want to list all products if table tb_tax has no entry for product then return null. so how can I acheive this.