作业帮 > 综合 > 作业

sql2000中把条件billdate between intime and intime中的intime加上30天,i

来源:学生作业帮 编辑:搜搜考试网作业帮 分类:综合作业 时间:2024/08/17 22:30:11
sql2000中把条件billdate between intime and intime中的intime加上30天,intime是字符型,该怎么做?
我现在有个库存表kc,需要把kc表中的商品查看入库后近30天有没有销售,kc表记录的入库时间为字符型的字段intime,我现在想把他和销售表xs连接在一起查询销量,但是我在intime后+30提示‘在将 varchar 值 '2013-06-01' 转换成数据类型 int 时失败’,我的语句是这样写的select * from kc left join xs on kc.rec = xs.rec where xs.billdate between intime and intime +30,我该怎么写才能自动给intime加上30天呢?
sql2000中把条件billdate between intime and intime中的intime加上30天,i
select * from kc left join xs on kc.rec = xs.rec where xs.billdate  
between intime  
and
left(convert(varchar,dateadd(day,30,convert(datetime,intime)),120),10)