我有这样的表:
+----------+------------+
| name | birthday |
+----------+------------+
| jean | 1988-08-09 |
| andrew | 1990-09-20 |
| jennifer | 1980-09-05 |
| Harry | 1985-10-25 |
| Chris | 1987-09-22 |
+----------+------------+
我想显示生日表中的结果,其中9月的生日和4到21之间的日期如下:
+----------+------------+
| name | birthday |
+----------+------------+
| andrew | 1990-09-20 |
| jennifer | 1980-09-05 |
+----------+------------+
有人可以帮助我吗?
答案 0 :(得分:1)
SELECT name,
birthday
FROM T
WHERE MONTH(birthday) = 9
AND DAY(birthday) > 4
AND DAY(birthday) < 21;
答案 1 :(得分:0)
SELECT NAME,BIRTHDAY
FROM YOURTABLE
WHERE MONTH(BIRTHDAY)=9 AND DAY(BIRTHDAY) BETWEEN 4 AND 21