select *
from DQ_Rp_Plan_Houseitem
where datediff(dd,cast('2012-04-12' as datetime),cast('2012-04-15' as datetime)) between 1 and 5和
select *
from DQ_Rp_Plan_Houseitem
where datediff(dd,cast('2012-04-12' as datetime),cast('2012-04-19' as datetime)) between 1 and 5和select *
from DQ_Rp_Plan_Houseitem
where datediff(dd,cast('2012-04-12' as datetime),cast('2012-04-15' as datetime)) between 1 and 10
怎么查结果都一样 结果都是数据表里的全部数据 没有 按指定时间显示哪里的问题?数据库的 日期字段 为字符串型的 vchar--------------------------------------------------但如果用SQL code
select *
from DQ_Rp_Plan_Houseitem
where datediff(dd,cast('2012-04-12' as datetime),getdate()) between 1 and 5
不提示错误 但会没有结果
from DQ_Rp_Plan_Houseitem
where datediff(dd,cast('2012-04-12' as datetime),cast('2012-04-15' as datetime)) between 1 and 5和
select *
from DQ_Rp_Plan_Houseitem
where datediff(dd,cast('2012-04-12' as datetime),cast('2012-04-19' as datetime)) between 1 and 5和select *
from DQ_Rp_Plan_Houseitem
where datediff(dd,cast('2012-04-12' as datetime),cast('2012-04-15' as datetime)) between 1 and 10
怎么查结果都一样 结果都是数据表里的全部数据 没有 按指定时间显示哪里的问题?数据库的 日期字段 为字符串型的 vchar--------------------------------------------------但如果用SQL code
select *
from DQ_Rp_Plan_Houseitem
where datediff(dd,cast('2012-04-12' as datetime),getdate()) between 1 and 5
不提示错误 但会没有结果
解决方案 »
- 如何在绑定FormView时,显示前,修改FormView中的显示値?
- CSDN BBS的treeview是如何实现页面更新的
- 没分了.还要问问题............................................................
- 为什么TaskMenu在asp.net中不能正常使用呢?asp,php,jsp都能正常使用?请各位尽力帮忙!
- 2.0,实在受不了了
- 请问这个有啥错?
- 数据库添加记录不成功,原因出在何处??
- 关于登录系统的一个问题
- 超复杂的sql语句求助!!!!!
- 如何禁止当鼠标指向GridView中的imagefield 字段的图片时出现图片的路径???
- Asp.net页面,如何是图片成比例缩放显示
- 请教有工作经验的ASP.NET高手一个数据展示问题
from DQ_Rp_Plan_Houseitem
where datediff(dd,cast('2012-04-12' as datetime),cast('2012-04-19' as datetime)) between 1 and 5这个绝对是没有数据的。
from DQ_Rp_Plan_Houseitem
where datediff(dd,cast('2012-04-12' as datetime),cast('2012-04-15' as datetime)) between 1 and 5where语句为true,返回的肯定是select * from DQ_Rp_Plan_Houseitem 的所有数据换成select *
from DQ_Rp_Plan_Houseitem
where datediff(dd,cast('2012-04-12' as datetime),数据库中的时间字段) between 1 and 5
print datediff(dd,cast('2012-04-12' as datetime),cast('2012-04-15' as datetime))
结合结果,看下你的where条件
2.datediff 里面的值 是不是匹配的有数据