📜  每月生日 SQL 查询 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:10.856000             🧑  作者: Mango

代码示例1
SELECT c.name
FROM cust c
WHERE (
    MONTH(c.birthdate) = MONTH(@suppliedDate)
    AND DAY(c.birthdate) = DAY(@suppliedDate)
) OR (
    MONTH(c.birthdate) = 2 AND DAY(c.birthdate) = 29
    AND MONTH(@suppliedDate) = 3 AND DAY(@suppliedDate) = 1
    AND (YEAR(@suppliedDate) % 4 = 0) AND ((YEAR(@suppliedDate) % 100 != 0) OR (YEAR(@suppliedDate) % 400 = 0))
)