同时要满足两个条件,
今年年份=去年年份+1
今年周=去年周
以SqlServer为例,sql大致如下
select * from
date_week a join date_week b on year(a.md_date)=year(b.md_date)+1
and a.md_week=b.md_week
用 时间字段 = YEARDELTA('${p_mdwkstr}',-1) 获取去年的数据
时间本年数据 a 时间去年数据 b
a left join b on a.week=b.week