跪求sql语句
该sql语句用于统计2008年各月通过各种渠道收到简历的数量
SQL code:
select way_type_name,way_name,Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec from(
select w.way_id , w.way_name,w.way_type_id,
sum(case when month(send_date)=1 then 1 else 0 end) as Jan,
sum(case when month(send_date)=2 then 1 else 0 end) as Feb,
sum(case when month(send_date)=3 then 1 else 0 end) as Mar,
sum(case when month(send_date)=4 then 1 else 0 end) as Apr,
sum(case when month(send_date)=5 then 1 else 0 end) as May,
sum(case when month(send_date)=6 then 1 else 0 end) as Jun,
sum(case when month(send_date)=7 then 1 else 0 end) as Jul,
sum(case when month(send_date)=8 then 1 else 0 end) as Aug,
sum(case when month(send_date)=9 then 1 else 0 end) as Sep,
sum(case when month(send_date)=10 then 1 else 0 end) as Oct,
sum(case when month(send_date)=11 then 1 else 0 end) as Nov,
sum(case when month(send_date)=12 then 1 else 0 end) as Dec
from tb_resume r inner join tb_way w
on r.way_id = w.way_id
where year(send_date) = 2008
group by w.way_id, w.way_name,w.way_type_id
)as g inner join tb_way_type wt
on g.way_type_id = wt.way_type_id
查询结果:
way_type_name way_name Jan Feb Mar Apr May Jun Jul Aug Sep Oc
相关问答:
今天做了一个存储过程 环境是SQL2000数据库
大致如下
建立临时表
定义员工游标
循环员工(属于1个公司)
......
现在有两张表:文章主表A(articleId,articleTitle),文章评论表B(commentId,articleId,commentTitle)
现在我想实现这样的功能:列出文章列表,其中每篇文章标题下面列出此文章的前2个文章评论,请问sql语句怎么写啊 ......
sql的软件在哪里可以下啊!在网上找了蛮多都用不了啊
随便搞一D版吧,
迅雷第一个就可以用
2000,2005都这样
http://119.147.41.16/down?cid=0698C2D64D7D637D90A6D2482298E6717D4F15CD&t=2&fmt=-1 ......
如何在SQL2005中设定定时作业,比如说定时清理某些表的数据,
或者是定时的将某些表的数据导出excel!
在线等待,急急急,最好是详细步骤!
之前我做的作业有点问题!
帮UP
参考:http://hi.baidu.com/toiota ......
第一句:
select ht.gfdm,gfdm.gfmc,gfdm.lb ,sum(jh.htdj*jh.htsl)as je
from ht left join gfdm on ht.gfdm=gfdm.gfdm
join jh on ht.htbh=jh.hth
and ht.htbh not like'del%' and ht. ......