I need a query that return values from the beginning of the current month until today.
For example :
SELECT *
FROM Orders
WHERE OrderDate BETWEEN #1/6/2016# AND Now();
But I need this query to work not just this month...
If you have a given date, you could use the DATESERIAL()
function to grab the first day of a given month :
SELECT *
FROM Orders
WHERE OrderDate BETWEEN DATESERIAL(Year(YourDate), Month(YourDate), 1) AND NOW()
If you were able to explicitly pass in the month and year, you could do that as well :
WHERE OrderDate BETWEEN DATESERIAL(2016, 6, 1) AND NOW()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.