这是我在 SQL 2008 视图中的语句。
SELECT TOP (100) PERCENT
dbo.[Billing Detail].Chart
, dbo.[Billing Detail].[Transaction Code]
, SUM(dbo.[Billing Detail].Units) AS [Total Billed]
FROM
dbo.[Billing Detail]
INNER JOIN dbo.Patient
ON dbo.[Billing Detail].Chart = dbo.Patient.[Chart Number]
WHERE
(dbo.[Billing Detail].[Transaction Code] = 'H2016')
AND (dbo.[Billing Detail].[Service Date 1] BETWEEN '2013-1-01 00:00:00.000'
AND '2013-1-31 00:00:000')
GROUP BY
dbo.[Billing Detail].Chart
, dbo.[Billing Detail].[Transaction Code]
ORDER BY
dbo.[Billing Detail].Chart
我正在尝试制作一个 IF 语句,其中 1-1-13 和 1-31-13 之间的单位总和是 JAN,所有日期在 2-1-13 和 2-28-13 = FEB 之间......在今年剩下的时间里如此。然后我需要将此信息导出到 Access 2010 或 Excell 2010。