求一句SQL查询语句 - MS-SQL Server / 疑难问题
表结构
ID ArticlesID AddTime
1 1 2010-5-1
2 1 2010-5-2
3 3 2010-5-2
4 2 2010-5-2
5 1 2010-5-2
6 2 2010-5-3
7 1 2010-5-3
8 2 2010-5-3
9 1 2010-5-3
我想知道 2010.5 这个月 ArticlesID 等于 1 的统计情况 效果如下
ArticlesID 日期 统计数
1 2010-5-1 1
1 2010-5-2 2
1 2010-5-3 2
SQL语句怎么写? 在线等!!!
SQL code:
selct ArticlesID,AddTime,统计数=count(1) from tb where ArticlesID=1
group by AddTime
试试
SQL code:
--> 测试数据:[tb]
if object_id('[tb]') is not null drop table [tb]
go
create table [tb]([ID] int,[ArticlesID] int,[AddTime] datetime)
insert [tb]
select 1,1,'2010-5-1' union all
select 2,1,'2010-5-2' union all
select 3,3,'2010-5-2' union all
select 4,2,'2010-5-2' union all
select 5,1,'2010-5-2' union all
select 6,2,'2010-5-3' union all
select 7,1,'2010-5-3' union all
select 8,2,'2010-5-3' union all
select 9,1,'2010-5-3'
--------------------------------查询开始------------------------------
select [ArticlesID],[AddTime],count(*
相关问答:
sqlserver2005 建立的数据库,与手持pda传输数据,最近突然出现无法传递数据的问题,pda端提示的错误时outofmemoryexception,但是pda上面的容量没有问题,
sqlserver的日子上的错误如下:
日期 2010-1-25 14:45: ......
字段1,字段2.....字段N,Status,ParentID
1,Name1....test1,1,99
1,Name1....test1,3,99
1,Name2....test2,1,101
1,Name2....test2,3,101
1,Name3....test3,2,101
1,Name1....test1,4,101
想要的结果是:
1,Na ......
请教高手:
以下是数据库中的三条记录,英文为字段名称
id planname TaskBeginTime Status
329 2010年03 ......
求个vb中的sql语句的写法,次sql语句的用法是分页程序
我写的如下:其中A是用来接收每页显示的记录的条数,B是用来接收显示的当前的页面.
sqltext="select top A * from log where id not in(select top ( ......