如何在SQL中获取特定月份的第一天和最后一天之间的数据?
以下是sql查询,请帮忙
DECLARE @mydate DATETIME
SELECT @mydate = GETDATE()
select TransactionCode from ReceiptsPayments
where ReferenceDate >= (SELECT CONVERT(VARCHAR(25),
DATEADD(dd,-(DAY(@mydate)-1),@mydate),
101) AS Date_Value)
AND ReferenceDate <= (SELECT CONVERT(VARCHAR(25),
DATEADD(dd,
-(DAY(DATEADD(mm,1,@mydate))),
DATEADD(mm,1,@mydate)),
101))
GO