我有两个SQL查询(SQL Server),它给了我两个结果。我想合并两个查询以获得一个整体结果。我尝试了许多排列,但似乎都没有。以下是两个查询:
SELECT DATEPART(YEAR,fld_one) [Year],
DATEPART(QUARTER,fld_one) [Quarter],
COUNT(1) [Licenses]
FROM tbl_licenses
GROUP BY DATEPART(YEAR,fld_one),DATEPART(QUARTER,fld_one)
ORDER BY 1,2
SELECT fld_company
FROM tbl_licenses
WHERE fld_quantity = (SELECT MAX(fld_quantity) FROM tbl_licenses)
基本上我希望fld_quantity值显示在YEAR
,QUARTER
和LICENSES
旁边的列中。
非常感谢任何帮助。