I am fetching data from a table using group by payment method. What happen is in group by the data comes up corresponding to those data only which are in table . But I want all payment types to be shown in result . I am using following query.
$query = "select paytype ,sum(totalamount) from `tbl_payments` group by paytype";
There are 5(cash,credit,paypal..) types of payment . I want all the payment methods with the result , so that if paytype is not find by query result it should be appended like ['credit'] =>[0] , means paytype => amount(which should be 0 at that case).
Please help me on this.