此代码在SQL Server中正常工作。但是Visual Studio中的tableadapter向导显示错误:
生成的SELECT语句
无法解析查询文本
代码:
SELECT
COUNT(NULLIF(bcg,'')) AS [babycount],
'BCG' as [Vaccines],
DATENAME(month, date)[Month],
year(GETDATE())[year]
FROM
IMMUNI
GROUP BY
DATENAME(month, date)
UNION ALL
SELECT
COUNT(NULLIF(hepab, '')) AS [babycount],
'Hepa B' AS [Vaccines],
DATENAME(month, date) [Month],
year(GETDATE()) [year]
FROM
IMMUNI
GROUP BY
DATENAME(month, date)
UNION ALL
SELECT
COUNT(NULLIF(pentaone, '')) AS [babycount],
'Penta One' AS [Vaccines],
DATENAME(month, date) [Month],
year(GETDATE()) [year]
FROM
IMMUNI
GROUP BY
DATENAME(month, date)
任何帮助将不胜感激。