首页 > 代码库 > 456789

456789

SELECT B.DESCRIPTION,B.PLANNAME,COUNT(*) 案件數FROM CASES A JOIN     (        select b.DESCRIPTION,a.PLANNAME,MAX(PLANSN) PLANSN        from [PLAN] a left join PLANTYPE b on a.TYPEID = b.TYPEID        WHERE PLANNAME NOT LIKE ‘%停%‘ AND PLANNAME NOT LIKE ‘%測%‘        GROUP BY  b.DESCRIPTION,a.PLANNAME     ) B ON A.PLANSN = B.PLANSNWHERE B_DATETIME >= ‘2013/1/1‘ and B_DATETIME <= ‘2013/4/30‘GROUP BY B.DESCRIPTION,B.PLANNAMEORDER BY 1