我得到一个查询,该查询多次使用具有相同列和过滤器的同一个表,唯一改变的是手动给出的类型。我认为必须有更好的方法来做到这一点。
查询语句如下:
Select Column 1, Column 2, Sum(Column 3) AS Test, "First Query" AS "Type"
From Table X
Where Column 1 = "Fly"
Group by Column 1, Column 2
UNION ALL
Select Column 1, Column 2, Sum(Column 3) AS Test, "Second Query" AS "Type"
From Table X
Where Column 1 = "Fly"
Group by Column 1, Column 2
UNION ALL
Select Column 1, Column 2, Sum(Column 3) AS Test, "Third Query" AS "Type"
From Table X
Where Column 1 = "Fly"
Group by Column 1, Column 2
谢谢!