Hello,
I have the below query, which gives me correct result if there is any product in daily sale, but if there is no product and only payments on customer_payments tables it show blank report. plz help
I have the below query, which gives me correct result if there is any product in daily sale, but if there is no product and only payments on customer_payments tables it show blank report. plz help
Code:
select `customer`.`ID`, `customer`.`full_name`,
`customer`.`shop_name`, `customer`.`address`,
`customer`.`city`, `customer`.`phone`, `customer`.`mobile`,
`customer`.`cDate`,
`customer_payments`.`ID` as `customer_payments_ID`,
`customer_payments`.`customer_id`,
`customer_payments`.`billno`,
`customer_payments`.`cDate` as `customer_payments_cDate`,
`customer_payments`.`bill_amount`,
`customer_payments`.`paid_amount`,
`customer_payments`.`discount`,
`customer_payments`.`ret_amount`,
`customer_payments`.`balance`,
`customer_payments`.`description`,
`dailysale`.`ID` as `dailysale_ID`, `dailysale`.`payment_id`,
`dailysale`.`product_id`, `dailysale`.`qty`,
`dailysale`.`price`, `dailysale`.`total`,
`dailysale`.`description` as `dailysale_description`,
`product`.`ID` as `product_ID`, `product`.`product_name`
from (((`customer` `customer`
left
join `customer_payments` `customer_payments`
on (`customer_payments`.`customer_id` = `customer`.`ID`))
inner join `dailysale` `dailysale`
on (`dailysale`.`payment_id` = `customer_payments`.`ID`))
left
join `product` `product`
on (`product`.`ID` = `dailysale`.`product_id`))
where not (`dailysale`.`product_id` is null)