这个时间查询怎么查包含当前日期得我这个显示得是当前日期但是查得没有当前日期得数据

image.png

FineReport FineBI 用户cfDDG9086548 发布于 2022-9-20 17:26 (编辑于 2022-9-21 08:51)
1min目标场景问卷 立即参与
回答问题
悬赏:4 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共5回答
最佳回答
0
CD20160914Lv8专家互助
发布于2022-9-21 08:55(编辑于 2022-9-21 08:56)

因为你的有时分秒

但是你录入的日期是年月日

你要改成这样:

where 1=1 

${if(len(starttime)=0,""," and y.creationTime>='"+starttime+"'")}

${if(len(endtime)=0,""," and y.creationTime<'"+endtime+" 23:59:59'")} 

image.png

最佳回答
0
Z4u3z1Lv6专家互助
发布于2022-9-20 17:28(编辑于 2022-9-20 17:28)

盲猜 你的开始时间大于(晚于)结束时间

  • 用户cfDDG9086548 用户cfDDG9086548(提问者) where 1=1 ${if(len(starttime)=0,\"\",\" and y.creationTime>=\'\"+starttime+\"\'\")}${if(len(endtime)=0,\"\",\" and y.creationTime<\'\"+endtime+\"\'\")} y.creationTime 这个是系统创建得时间
    2022-09-21 08:48 
  • Z4u3z1 Z4u3z1 回复 用户cfDDG9086548(提问者) 第二个用小于等于啊 where 1=1 ${if(len(starttime)=0,\"\",\" and y.creationTime>=\'\"+starttime+\"\'\")}${if(len(endtime)=0,\"\",\" and y.creationTime<=\'\"+endtime+\"\'\")}
    2022-09-21 08:56 
最佳回答
0
runerLv7资深互助
发布于2022-9-20 17:28

between? <=?

最佳回答
0
用户k6280494Lv6资深互助
发布于2022-9-20 17:37

where 字段 between 开始时间 and 结束时间

最佳回答
0
congerLv6高级互助
发布于2022-9-20 18:03

你的数据集参数是不是写反了

我之前也犯过这个错误

/(ㄒoㄒ)/~~

  • 用户cfDDG9086548 用户cfDDG9086548(提问者) 我得意思是 我查询得时间是没问题 但是我查得只是不包含当前日期得数据 是前一天得数据
    2022-09-21 08:53 
  • conger conger 回复 用户cfDDG9086548(提问者) 你sql是不是写的小于
    2022-09-21 09:13 
  • 5关注人数
  • 254浏览人数
  • 最后回答于:2022-9-21 08:56
    请选择关闭问题的原因
    确定 取消
    返回顶部