2つのSQLステートメントがあります
SELECT TOP 100 PERCENT COUNT(CodeAll) AS Total, CodeAll, Description,
LEFT(CodeAll, 1) AS Code
FROM Data WHERE DATE BETWEEN '2013/03/01 00:00:00' AND '2013/03/01 23:59:00'
AND (CodeAll Is Not Null)
GROUP BY CodeAll, Description ORDER BY Code
ASC
結果:
Total | CodeAll | Description | Code
-------------------------------------
3 1c Test 1
3 1b Test2 1
10 1a Test3 1
2 2a Test4 2
5 2b Test5 2
5 3a Test6 3
3 3b Test7 3
クエリ #2:
SELECT COUNT(CodeAll) AS SumCall, LEFT(CodeAll, 1) AS Code FROM Data
WHERE DATE BETWEEN '2013/03/01 00:00:00' AND '2013/03/01 23:59:00'
AND (CodeAll Is Not Null) GROUP BY LEFT(CodeAll, 1)`
結果:
SumCall| Code
16 1
7 2
8 3
2 つのクエリを 1 つのクエリに結合して生成したい:
Total | CodeAll | Description | Code | SUM | Percentage
---------------------------------------------------------
3 1c Test 1 16 18.75 %
3 1b Test2 1 16 18.75 %
10 1a Test3 1 16 62.5 %
2 2a Test4 2 7 28.57 %
5 2b Test5 2 7 71.43 %
5 3a Test6 3 8 62.5 %
3 3b Test7 3 8 37.5 %
クエリ??
助けてください