假设我有以下表格:
1) tblScore
============================
Date VendorID Score
============================
12/09/01 12001 A
12/09/01 12001 A
12/09/01 12002 B
12/09/02 12003 C
12/09/02 12003 A
12/09/03 12001 C
============================
我有这个查询:
SELECT ts.VendorID, ts.Score, COUNT(*)
FROM trxscore ts
GROUP BY ts.VendorID, ts.Score
ORDER BY ts.VendorID, ts.Score
但是如何展示表格像这样:
===========================
VendorID A B C
===========================
12001 2 0 1
12002 0 1 0
12003 1 0 1
===========================
另外,从文本中获取平均值是否可能?例如:VendorID 12001
应该获得 A 的平均值。谢谢...