首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

sql统计查询有关问题 麻烦死了 帮个忙吧

2012-05-29 
sql统计查询问题 麻烦死了 帮个忙吧数据库有个字段fxsj(日期/时间),通过sql查询某年度某月份的记录集的个

sql统计查询问题 麻烦死了 帮个忙吧
数据库有个字段fxsj(日期/时间),
通过sql查询某年度某月份的记录集的个数!例如:2011年12月中记录集的个数
sql="select count(id) as num where ....)"咋写?

[解决办法]
select count(id) as num from 表 where month(日期)=12

select count(*) as c from(select * from ss inner join gq where ss.gqmc=qq.gqmc) as t1 inner join cj where t1.id=cj.id group by cj.id
[解决办法]
select count(*) from table_name where to_char(fxsj,'yyyy-mm')='2011-12';
[解决办法]
Select count(c.*)
From cj As a,gq As b,ss As c
Where convert(varchar,datepart(mm,c.fxsj)) = '要查询的月份' ' And c.gqmc = b.gqmc And b.cjid = a.id
试试

热点排行