→ fantasyj:select sum(amount) as a, avg(amount) as b from table 09/15 08:54
→ pttsasho:這樣求出來的應該是平均值吧! 我想查詢的是各別客戶的 09/15 09:26
→ pttsasho:比重。比方說A客戶比重為:10/60 = 0.167 這樣,謝謝! 09/15 09:27
→ fantasyj:select a.customer, a.amount, a.amount / b.toal_amt 09/15 18:33
→ fantasyj: from table as a, 09/15 18:34
→ fantasyj: (select sum(b.amount) as total_amt 09/15 18:34
→ fantasyj: from table as b) as b 09/15 18:34