I know that DateDiff cannot be used in Access, so how can we select several records before the specified date?
Although the DateDiff function cannot be used in Access, we can use the date function to implement this function. Take a look at the following "large" example, which is to implement how to select the first 8 records including today and before today:
select TOP 3 * from mytable where ((YEAR(ndate)<"&year(now)&") or (YEAR(ndate)="&year(now)&" and MONTH(ndate)<"&month(now)&") or (YEAR(ndate)="&year(now)&" and MONTH(ndate)="&month(now)&" and DAY(ndate)<="&day(now)&")) and fenlei=4 order by id DESC
Although the DateDiff function cannot be used in Access, we can use the date function to implement this function. Take a look at the following "large" example, which is to implement how to select the first 8 records including today and before today:
select TOP 3 * from mytable where ((YEAR(ndate)<"&year(now)&") or (YEAR(ndate)="&year(now)&" and MONTH(ndate)<"&month(now)&") or (YEAR(ndate)="&year(now)&" and MONTH(ndate)="&month(now)&" and DAY(ndate)<="&day(now)&")) and fenlei=4 order by id DESC