remindDays = 7
sql="select 姓名,生日from 客户表 where datediff('d', cstr(year(date())) + '-' + cstr(month(Cfax)) + '-' + cstr(day(Cfax)),date())<=" & remindDays & " and datediff('d', cstr(year(date())) + '-' + cstr(month(Cfax)) + '-' + cstr(day(Cfax)),date())>=0 order by ID desc"
这段代码哪里错了?
ie可以显示,但是没有数据显示出来
asp系统中,设置顾客生日提醒的代码 急啊!
答案:3 悬赏:10
解决时间 2021-03-14 08:40
- 提问者网友:践踏俘获
- 2021-03-14 00:08
最佳答案
- 二级知识专家网友:狙击你的心
- 2021-03-14 00:17
where datediff('d', cstr(year(date())) + '-' + cstr(month(Cfax)) + '-' + cstr(day(Cfax)),date())<=" & remindDays & "
这一句话!date()你的意思这个是当前时间对吧。 那当前时间和生日去比<=7?
这datediff 函数是后面的时间换算成天为单位去减前面的、那么你这句话的意思就是说过去7天内生日的客户。
你其实可以换一下。where datediff('d', date(),cstr(year(date())) + '-' + cstr(month(Cfax)) + '-' + cstr(day(Cfax)))<=" & remindDays & "
后面也换一下。
这一句话!date()你的意思这个是当前时间对吧。 那当前时间和生日去比<=7?
这datediff 函数是后面的时间换算成天为单位去减前面的、那么你这句话的意思就是说过去7天内生日的客户。
你其实可以换一下。where datediff('d', date(),cstr(year(date())) + '-' + cstr(month(Cfax)) + '-' + cstr(day(Cfax)))<=" & remindDays & "
后面也换一下。
全部回答
- 1楼网友:24K纯糖
- 2021-03-14 02:24
你把 sql 输出 看看输出什么语句 然后放在查询分析器运行下 看看
- 2楼网友:野性且迷人
- 2021-03-14 01:16
select id, name, birthday
from 顾客表
datediff(dd,birthday,getdate())=-5 提前5天提醒,你可以把5修改修改成你想提前的天数
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯