MSSQL ~ get current month records

SELECT *
FROM [Products]
WHERE
DatePart(MM, SubmitTime) = DatePart(MM, GetDate())
AND
DatePart(YY, SubmitTime) = DatePart(YY, GetDate())


reference
http://sqldud.blogspot.com/2007/06/now-function-in-sql-server.html

沒有留言: