SQL that list all birthdays within the next and previous 14 days

前端 未结 7 1489
梦谈多话
梦谈多话 2021-01-05 22:30

I have a MySQL member table, with a DOB field which stores all members\' dates of birth in DATE format (Notice: it has the \"Year\" pa

相关标签:
7条回答
  • 2021-01-05 23:14

    Easy,

    We can obtain the nearer birthday (ie the birthday of this year) by this code:

    dateadd(year,datediff(year,dob,getdate()),DOB)
    

    use this in your compares ! it will work.

    0 讨论(0)
提交回复
热议问题