修改了執行過程的語句寫法,sql的用ifelse的拼接換成了casewhen的寫法,簡潔了**,select語句新增了巢狀,因為sum3個表的時候,兩兩關聯,一次性取合會出現多次重複的操作,相當於先存入totle臨時表,再進行一次select查詢
select
totle.fbillno as 銷售訂單編號,
totle.fname as 客戶名稱,
totle.fdate as 訂單日期,
totle.fname1 as 業務員,
totle.fnumber as 產品**,
totle.fname2 as 產品名稱,
totle.fmodel as 規格型號,
totle.fname3 as 單位,
totle.fauxqty2 as 訂單數量,
sum(totle.fqty1) as "發貨申請數量(累計)",
sum(totle.fauxqty) as "發貨通知數量(累計)",
sum(totle.famount1) as "發貨申請金額(累計)",
sum(totle.famount) as "發貨通知金額(累計)"
from( select
a.fbillno as fbillno,
kh.fname as fname,
a.fdate as fdate,
yw.fname as fname1,
wl.fnumber as fnumber,
wl.fname as fname2,
wl.fmodel as fmodel,
mu.fname as fname3,
b.fauxqty as fauxqty2,
te.fqty as fqty1,
sum(c.fauxqty) as fauxqty,
te.famount as famount1,
sum(c.famount) as famount
from seorder a
inner join seorderentry b on a.finterid=b.finterid
inner join t_bos250000001entry2 te on te.fid_src=b.finterid
and te.fentryid_src=b.fentryid
inner join t_bos250000001 t on t.fid=te.fid
left join t_organization kh on kh.fitemid=a.fcustid
left join t_emp yw on yw.fitemid=a.fempid
left join t_icitem wl on wl.fitemid=b.fitemid
left join t_measureunit mu on mu.fitemid=b.funitid
left join seoutstockentry c on c.fsourcebillno=t.fbillno and te.fid = c.fsourceinterid
where 1=1 and a.fbillno =
case when isnull(@fbillno,'')=''then a.fbillno else @fbillno end
and kh.fname =
case when isnull(@fname,'')='' then kh.fname else @fname end
and a.fdate >=
case when isnull(@starttime,'')='' then a.fdate else @starttime end
and a.fdate <=
case when isnull(@endtime,'')='' then a.fdate else @endtime end
group by a.fbillno ,
kh.fname ,
a.fdate ,
yw.fname,
wl.fnumber ,
wl.fname ,
wl.fmodel,
mu.fname ,
b.fauxqty ,te.fqty,te.famount
)totle
group by totle.fbillno ,
totle.fname ,
totle.fdate,
totle.fname1 ,
totle.fnumber ,
totle.fname2 ,
totle.fmodel ,
totle.fname3 ,
totle.fauxqty2
多檔案修改版
這是繼上乙個錯誤之後,張玉老師給修改的,一開始我的類物件宣告是全域性變數,所以多檔案了以後,求周長那裡就出了問題。這一版不但解決了問題,更是幫我省出了很大的空間,身為類成員的兩個函式代替了六個資料成員,留出了空間,程式也不那麼亂七八糟了。棒!程式 main 作 者 趙玲玲 完成日期 2014 年 4...
佛緣(結局修改版)
闌珊因不滿前一篇的結局部份,所有才有了這個補丁,當然得轉過來。闌珊的文字功底的確n8錯,似乎她可以去維護世界和平了,呵呵!佛緣 修改版sp20061006 我才知道佛祖的法力早已突飛猛進,塵世浮游,他都能看得一清二楚了,而我也在他的手上,看世事變遷,只是,無論如何,都回不到曾經平淡的心境了。曾幾何時...
模板匹配 Match Template 修改版
修改者 madturtle 對於王先生的版本進行了修改,因為有些地方不對。模板匹配的工作方式 模板匹配的工作方式跟直方圖的反向投影基本一樣,大致過程是這樣的 通過在輸入影象上滑 像塊對實際的影象塊和輸入影象進行匹配。假設我們有一張100x100的輸入影象,有一張10x10的模板影象,查詢的過程是這樣...