SQLCE:如何计算日期部分
很长一段时间我都在努力解决以下主题:我想计算日期部分值。我使用 SQL Compact Edition 4.0,不知道如何获得以下内容:
select datepart(week, CreateDate) as Week, count(*) from tblOrders
where CreateDate>'12 April 2010' and CreateDate<'25 June 2011'
这显然不起作用,但为了让您了解我想要得到的结果是: - 2 列,
- 其中一列称为“周” - 这将是第二列中的周数
- - 我每周有多少订单
提前致谢,
Pete
For a long time I am struggling with the following subject: I want to count datepart values. I use SQL Compact Edition 4.0 and have no idea on how to get the following:
select datepart(week, CreateDate) as Week, count(*) from tblOrders
where CreateDate>'12 April 2010' and CreateDate<'25 June 2011'
This does not work obviously, but to give you an idea what I want to get as the result is:
- 2 columns,
- one called "week" - that would be a week number
- in the second column - how many orders I had per week
Thanks in advance,
Pete
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要添加 Group By 以使查询语法正确。
这有帮助吗?
You'll need to add a Group By to make the query syntax correct.
Does that help?