---
title: "今天写的一条sql语句"
author: "hwpok"
date: "2008-10-28T14:18:00Z"
tags: []
slug: "sql"
draft: false
lastmod: "2008-10-28T14:18:00Z"
id: 615802
url: "https://hwpok.iteye.com/blog/615802"
---

&lt;!--&lt;br /&gt; &lt;br /&gt; Code highlighting produced by Actipro CodeHighlighter (freeware)&lt;br /&gt; http://www.CodeHighlighter.com/&lt;br /&gt; &lt;br /&gt; --&gt;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 '%%')  
  );