我有这个问题:
SELECT
[QUERY1].[py],
[QUERY1].[al],
[QUERY1].[ga],
[QUERY1].[sy],
[QUERY1].[pl]
FROM [tab-Sample] as QUERY1, [tab-Sample]
WHERE [tab-Sample].[py] = [QUERY1].[py] AND
[tab-Sample].[al] <> [QUERY1].[al]
我想写一个查询,jsut计算这一个的结果,我找不到在哪里插入Count(*)也尝试过Over()但我无法管理这个。
答案 0 :(得分:0)
将所有内容包装为FROM
中的子选择。但请确保您为其命名(Total
)。
COUNT (*) AS Amount FROM
(
SELECT
[QUERY1].[py],
[QUERY1].[al],
[QUERY1].[ga],
[QUERY1].[sy],
[QUERY1].[pl]
FROM [tab-Sample] as QUERY1, [tab-Sample]
WHERE [tab-Sample].[py] = [QUERY1].[py] AND
[tab-Sample].[al] <> [QUERY1].[al]
) Total