今天写的一条sql语句

今天写的一条sql语句
select  
  gsb.id,gsb.submit_time,ui.true_name,x.type_count,x.goods_count,x.supplied_count
from  
  mw_goods_supply_book gsb,
  mw_user_info ui,
  (
select  supply_book_id,  count (goods_id) type_count, sum (goods_count) goods_count, sum (nvl(supplied_goods_count, 0 )) supplied_count  from  MW_GOODS_SUPPLY_BOOK  group   by  supply_book_id) x
where
  gsb.id 
=  x.supply_book_id  and  
  gsb.submit_user_id
= ui.id  and  
  gsb.supply_company_id
= 1   and  
  gsb.id 
in  
  (
      
select  y.id 
      
from  mw_goods_supply_book y 
      
where  y.goods_id  in (
        
select  gi.id  from  mw_goods_info gi  where  gi.goods_name  like   ' %% ' )
  );

你可能感兴趣的:(今天写的一条sql语句)