当前时间周的起始日期(以周一为例)select (week,(week,0,getdate()),0) 上周起始:select (week,-1,(week,(week,0,getdate()),0)) 上上周起始:select dateadd(week,-2,DATEADD(week,(week,0,getdate()),0)) 上上上周起始:select dateadd(week,-3,DATEADD(week,DATEDIFF(week,0,getdate()),0)) 周七以此类推
本文共 247 字,大约阅读时间需要 1 分钟。
当前时间周的起始日期(以周一为例)select (week,(week,0,getdate()),0) 上周起始:select (week,-1,(week,(week,0,getdate()),0)) 上上周起始:select dateadd(week,-2,DATEADD(week,(week,0,getdate()),0)) 上上上周起始:select dateadd(week,-3,DATEADD(week,DATEDIFF(week,0,getdate()),0)) 周七以此类推
转载地址:http://smxzx.baihongyu.com/