sqlserver,生日查询条件

AND (

(

datediff(

d,

'2000' + '-' + Rtrim(MONTH(Birthday)) + '-' + Rtrim(DAY(Birthday)),

'2000' + '-' + Rtrim(MONTH(#{queryEndTime})) + '-' + Rtrim(DAY(#{queryEndTime}))

)<= #{tianShu}

AND datediff(

d,

'2000' + '-' + Rtrim(MONTH(Birthday)) + '-' + Rtrim(DAY(Birthday)),

'2000' + '-' + Rtrim(MONTH(#{queryEndTime})) + '-' + Rtrim(DAY(#{queryEndTime}))

)>= 0

)

OR (

datediff(

d,

DATEADD(

yyyy ,- 1,

'2000' + '-' + Rtrim(MONTH(Birthday)) + '-' + Rtrim(DAY(Birthday))

)

,

'2000' + '-' + Rtrim(MONTH(#{queryEndTime})) + '-' + Rtrim(DAY(#{queryEndTime}))

)<= #{tianShu}

AND datediff(

d,

DATEADD(

yyyy ,- 1,

'2000' + '-' + Rtrim(MONTH(Birthday)) + '-' + Rtrim(DAY(Birthday))

)

,

'2000' + '-' + Rtrim(MONTH(#{queryEndTime})) + '-' + Rtrim(DAY(#{queryEndTime}))

)>= 0

)

)

你可能感兴趣的:(sqlserver,生日查询条件)