If I understand the problem correctly, then something like this should work:
declare @today date = convert(date, getdate());
select
[Day Total] = sum(case when [AccountingDate] >= @today and [AccountingDate] < dateadd(day, 1, @today) then [Amount] else 0 end),
[Month Total] = sum(case when [AccountingDate] >= @today and [AccountingDate] < dateadd(month, 1, @today) then [Amount] else 0 end),
[Year Total] = sum(case when [AccountingDate] >= @today and [AccountingDate] < dateadd(year, 1, @today) then [Amount] else 0 end)
from
[Accounting].[dbo].[HandPay];
Please note that [Month Total]they [Year Total]do not give the amount of records that occur during the current month / year, but rather the amount of records that occur during the month / year of today's date. I'm not sure if this is what you want, but it looks like the original queries.
:. D Stanley , , , , [Day Total] [Month Total], [Year Total]. :
declare @today date = convert(date, getdate());
select
[Day Total] = sum(case when [AccountingDate] < dateadd(day, 1, @today) then [Amount] else 0 end),
[Month Total] = sum(case when [AccountingDate] < dateadd(month, 1, @today) then [Amount] else 0 end),
[Year Total] = sum([Amount])
from
[Accounting].[dbo].[HandPay]
where
[AccountingDate] >= @today and [AccountingDate] < dateadd(year, 1, @today);