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
)
)