0
我不能運行這個功能,就是這種情況有什麼變化:有人能幫我找到上個月在mysql中的第一個日期嗎?
CREATE FUNCTION [GetFirstDateofMonth]
(@Date as DateTime)
RETURNS DateTime AS
BEGIN
Declare @FirstDate DateTime
Set @FirstDate = DateAdd(Day, 1, @Date - Day(@Date) + 1) -1
RETURN @FirstDate
END
CREATE FUNCTION [GetLastDateofMonth]
(@Date as DateTime)
RETURNS DateTime AS
BEGIN
Declare @LastDate DateTime
Set @LastDate = DateAdd(Month, 1, @Date - Day(@Date) + 1) -1
RETURN @LastDate
END