且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

获取两个日期之间的 ID

更新时间:2023-01-30 10:54:33

一个简单的 SELECT WHERE BETWEEN 应该可以为您完成这项工作.传入两个日期作为参数,并

A simple SELECT WHERE BETWEEN should do the job for you. Pass in the two dates as parameters, and

SELECT week_id FROM TBL_S3_FISCALWEEKS_1 
WHERE WeekStartDate BETWEEN @DateParam1 AND @DateParam2

即使确切的日期没有出现在 WeekStartDate 中,这也会起作用

This will work even if the exact date doesn't appear in WeekStartDate