2009-06-10 70 views
0

交叉查詢可以做到這一點嗎? (在Access 2007中)交叉查詢問題 - (sum&avg)

我有這張表:

50 | A1

60 | A1

70 | B1

80 | B1

90 | C1

我需要得到這樣的結果:

A1 ------------------ B1 -------------- - C1

sum |平均-----總和|平均-----總和| avg

55 | 110 --------- 75 | 130 ------ 90 | 90

我嘗試賴特這樣的:

TRANSFORM Sum(Worki.Value) AS XXsum 
SELECT Worki.Name AS Name, Worki.Tdate AS Tdate, Worki.ID AS ID 
FROM Worki 
GROUP BY Worki.Name, Worki.Tdate, Worki.ID 
PIVOT Worki.Trit; 

我怎樣才能獲得平均和求和?

回答

1

嘗試像

select sum(colname),avvg(colname) from tablename group by colname 
+0

那麼您所使用的查詢,什麼是表結構也告訴我們 – 2009-06-10 07:39:49