I have this difficulty with my query for my report.
I want to create report that use bar chart, for the data I'm using
query to get it.
This is my query :
SELECT p.name,MONTHNAME(s.date) as month,if(sum(d.quantity) IS Null,
0,sum(d.quantity)) as sumQuantity from products p inner join (sales s
inner join sales_details d on s.id=d.sale_id) on p.id=d.product_id
WHERE S.date BETWEEN CAST('2007-01-01 00:00:00' as Datetime) AND
CAST('2007-07-30 23:59:59' as Date) group by MONTHNAME(s.date),p.id;
The problem is when there is no record on that month for the product i
want it to show 0 value, so the chart will show ...