((YEAR(日期)=${YK} and Month(日期)<=${MK}) or (YEAR(日期)=${YK}-1 and Month(日期)>${MK}))
数据库改这个格式
and 日期 between '${MONTHDELTA(CONCATENATE(YK,"-",MK,"-01"),-6)}' and '${DATEINMONTH(CONCATENATE(YK,"-",MK,"-01"),-1)}'
((YEAR(日期)='${YK}' and Month(日期)<='${MK}') and (YEAR(日期)='${YK-1}' and Month(日期)>'${MK}'))