¹òÇó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
Ïà¹ØÎÊ´ð£º
ÏÖÔÚÓÐÁ½ÕÅ±í£ºÎÄÕÂÖ÷±íA(articleId,articleTitle)£¬ÎÄÕÂÆÀÂÛ±íB(commentId,articleId,commentTitle)
ÏÖÔÚÎÒÏëʵÏÖÕâÑùµÄ¹¦ÄÜ£ºÁгöÎÄÕÂÁÐ±í£¬ÆäÖÐÿƪÎÄÕ±êÌâÏÂÃæÁгö´ËÎÄÕµÄǰ2¸öÎÄÕÂÆÀÂÛ£¬ÇëÎÊsqlÓï¾äÔõôд°¡ ......
select count(1) from FX_RETURNBOOKCHECKLIST fxreturnbo0_ where fxreturnbo0_.BOOKID='164 ' AND fxreturnbo0_.RETURNID='00025.S0000001'
ÉÏÃæÒ»¸ö¼òµ¥µÄSQL,Ö´ÐÐʱ¼ä2.6à ......
ÓÐÁ½¸ö»òÒÔÉϵÄÔ¶³ÌÊý¾Ý¿â£¬ÈçºÎÓÃASP¼ì²âÁ¬½ÓËٶȲ¢Á¬½Ó×î¿ìµÄMSSQLÊý¾Ý¿â£¿
ÓÐÕâÑùµÄASPº¯ÊýÂð£¿ÎÒGOOGLEÁËһϣ¬ÕÒ²»µ½¡£
PHP+MYSQLÏÂÓÐÕâÖÖÀý×Ó£º
PHP code:
Example:
$wgDBservers = array(
......
µÚÒ»¾ä:
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. ......