select op.product_id, p.upc, cd.name as category, p.model as name, sum(op.quantity) as qty, round(sum(op.total*(o.membership_discount)/100),4) as membership_discount, round(sum(op.total)) as total, round(sum(op.tax*op.quantity), 4) as tax, round((sum(op.quantity)*max(pwb.weight_base))/1000,3) as weight
from
oc_order o
left join oc_order_product op on op.order_id = o.order_id
left join oc_product p on p.product_id = op.product_id
left join oc_product_weight_base pwb on pwb.product_id = op.product_id
left join (select pc.product_id, min(pc.category_id) as category_id from oc_product_to_category pc join oc_category c on c.category_id = pc.category_id where c.parent_id = 0 group by pc.product_id) ptc on op.product_id = ptc.product_id left join oc_category_description cd on ptc.category_id = cd.category_id
where
o.order_status_id in (5,2,3,19)
and o.delivery_date>=date({{start_date}}) and o.delivery_date<=date({{end_date}})
and o.shipping_warehouse_id in (select warehouse_id from oc_warehouse where status=1 and name in ({{warehouse}}))
group by op.product_id;
In the above query, i use filed filer for warehouse names but the problem is i want only list of warehouse in dropdown who have status = 1 i.e true in my table but in dropdown all warehouse name shows.
how can it resolve?