hi im new in database query, i need some help to solve my proble, here is the table imagetable
and this is my query:
SELECT w.name as wholesaler_name, w.outlet_id,w.distributor_name, w.distributor_id, wt.name as tipe_plus, v.target, v.week as periode, sum(v.total_transaction), v.rebate, v.total_voucher
FROM voucher v
JOIN wholesalers w ON w.id=v.wholesaler_id
JOIN wholesaler_types wt ON w.wholesaler_type_id=wt.id
GROUP BY w.name, w.outlet_id, w.distributor_name, w.distributor_id, wt.name, v.target, v.week, v.rebate, v.total_voucher;
chek total_vouchers
column.
In your query everething will be ok if total_vouchers
are same for 11.2017
, because your query finaly step will want grouping by total_vouchers
, in your result link i can not see total_vouchers
, if they are not same for 11.2017
then exclude that column from group by
and select or put that column in Sum(), Count().... (aggregate function) in select
Section