我的数据表里有 Update 项 为时间 格式是 2006-10-1
如果我要选取 其中一个时间段的 比如 2006年9月10日 到2006年9月17日 该如何实现?另一个问题是 Name、Numbe、Update 3项 分别为 名称 数量和时间
在不同是时间段里 如果有名称相同的项 那么数量要相加 该如何实现?希望高手帮我解决下 谢谢!我用ASP语言。
如果我要选取 其中一个时间段的 比如 2006年9月10日 到2006年9月17日 该如何实现?另一个问题是 Name、Numbe、Update 3项 分别为 名称 数量和时间
在不同是时间段里 如果有名称相同的项 那么数量要相加 该如何实现?希望高手帮我解决下 谢谢!我用ASP语言。
如果我要选取 其中一个时间段的 比如 2006年9月10日 到2006年9月17日 该如何实现?
====================
select * from 表名
where [Update] between '2006-9-10' and '2006-9-17'
在不同是时间段里 如果有名称相同的项 那么数量要相加 该如何实现?
================
每天的汇总数量select [Name],[Update],sum([Numbe]) as [Numbe] from 表名
group by [Name],[Update]
第一个问题 是 用between 的话 MSSQL里 Update 的数据类型是否必须smalldatatime类型?
第二个问题 是 如果是一个时间段 不是每天的
select [Name],[Update],sum([Numbe]) as [Numbe] from 表名
group by [Name] between '2006-9-10' and '2006-9-17'
是这样吗?谢谢
where [Update] between '2006-9-10' and '2006-9-17'
select [Name],[Update],sum([Numbe]) as [Numbe] from 表名
group by [Name],[Update]
group by [Name] and [Update] between '2006-9-10' and '2006-9-17'漏写了 呵呵 这样是吗?
where [Update] between '2006-9-10' and '2006-9-17'
group by [Name]
where [Update] between '2006-9-10' and '2006-9-17'
group by [Name]