计算时间的问题:在3-5月里,要出每个星期日A部门的销售量.请问高手如何解决?

wu876 2006-09-04 03:49:28
同上
...全文
315 21 打赏 收藏 转发到动态 举报
写回复
用AI写文章
21 条回复
切换为时间正序
请发表友善的回复…
发表回复
wu876 2006-09-13
  • 打赏
  • 举报
回复
还有吗
wu876 2006-09-12
  • 打赏
  • 举报
回复
我是的SQL2000,查询结果可以出来,但同样报错
wu876 2006-09-11
  • 打赏
  • 举报
回复
阿飞哥,不行啊!出现"从字符串转换为 datetime 时发生语法错误"
tttl366 2006-09-11
  • 打赏
  • 举报
回复
你看下帮助文档,可能不同版本的数据库函数的参数和格式不太一样
tttl366 2006-09-09
  • 打赏
  • 举报
回复
select * from table
where DATEPART(weekday,rq) = 1 and ((left(convert(char(10),rq,112),6) > '200603')and (left(convert(char(10),rq,112),6) < '200605'))
tttl366 2006-09-09
  • 打赏
  • 举报
回复
我的就可以啊
select * from table
where DATEPART(weekday,rq) = 1 and ((left(convert(char(10),action_time,112),6) > '200603')and (left(convert(char(10),action_time,112),6) < '200605'))
wu876 2006-09-08
  • 打赏
  • 举报
回复
执行DATEPART(weekday,rq) = 1 and (rq between '2004/03/01' and '2004/05/31')时,出现从字符串转换为 datetime 时发生语法错误。
wu876 2006-09-08
  • 打赏
  • 举报
回复
有人会吗
tttl366 2006-09-07
  • 打赏
  • 举报
回复
dayname在sql语句中不能用
用 DATENAME(weekday,rq)或DATEPART(weekday,rq)
wu876 2006-09-07
  • 打赏
  • 举报
回复
执行where dayname(rq) = 'sunday' and (rq between 3 and 5)时出现,从字符串转换为 datetime 时发生语法错误。
wu876 2006-09-07
  • 打赏
  • 举报
回复
从字符串转换为 datetime 时发生语法错误。
tttl366 2006-09-07
  • 打赏
  • 举报
回复
select DATENAME(weekday,getdate())
返回'星期四'(今天)
tttl366 2006-09-07
  • 打赏
  • 举报
回复
where DATEPART(weekday,rq) = 1
数据库默认星期天为第一天
zsforever 2006-09-07
  • 打赏
  • 举报
回复
set datefirst 7
select * from 你的表名
where datepart(month,你的时间字段)>=3 and datepart(month,你的时间字段)<=5 and datepart(dw,你的时间字段)=1
tttl366 2006-09-07
  • 打赏
  • 举报
回复
where dayname(rq) = 'sunday' and (rq between 3 and 5)
wu876 2006-09-07
  • 打赏
  • 举报
回复
dateColumn 是什么意思
wu876 2006-09-07
  • 打赏
  • 举报
回复
code 部门科号, name 部门, brrs 销售量, rq 日期
mugua604 2006-09-04
  • 打赏
  • 举报
回复
什么都没有,叫我们杂写?
zsforever 2006-09-04
  • 打赏
  • 举报
回复
select * from TableN
where dateColumn between 3-5月 and datepart(dw,dateColumn)=1
wu876 2006-09-04
  • 打赏
  • 举报
回复
有具体的语句吗
加载更多回复(1)

22,209

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧