si.id as invId, loc.id as locationId,loc.location_code,goods.vehiche_model,goods.color,loc.location_status,count(stock.id) goodQty
si.id as invId, loc.id as locationId,loc.location_code,goods.vehiche_model,goods.color,loc.location_status, sum(case when stock.goods_no is null then 0 else 1 end ) as goodQty,inv_order_no
select loc.id as locationId, loc.location_code,goods.vehiche_model,goods.color,loc.location_status,count(stock.id) goodQty
select loc.id as locationId, loc.location_code,goods.vehiche_model,goods.color,loc.location_status, sum(case when stock.goods_no is null then 0 else 1 end ) as goodQty
from base_location loc
left join sys_stock_detail stock on loc.id =stock.location_id
left join base_goods_data goods on stock.goods_no=goods.goods_no