这句sql 换做oracle 应该杂个写!(50分)

  • 主题发起人 主题发起人 www.ynxbs.com
  • 开始时间 开始时间
W

www.ynxbs.com

Unregistered / Unconfirmed
GUEST, unregistred user!
Accessselect = 'select 年龄组,性别,count(*) as 受检人数,' +<br>&nbsp; &nbsp; &nbsp; &nbsp; 'sum(IIf(低体重+消瘦+发育迟缓+严重营养不良=0,1,0)) as 正常数,' +<br>&nbsp; &nbsp; &nbsp; &nbsp; 'sum(IIf(低体重+严重营养不良=2,0,低体重) ) AS 低体重数,' +<br>&nbsp; &nbsp; &nbsp; &nbsp; 'sum(消瘦 ) AS 消瘦数,' +<br>&nbsp; &nbsp; &nbsp; &nbsp; 'sum(发育迟缓 ) AS 发育迟缓数,' +<br>&nbsp; &nbsp; &nbsp; &nbsp; 'sum(严重营养不良 ) AS 严重营养不良数,' +<br>&nbsp; &nbsp; &nbsp; &nbsp; 'sum(体重大于XSZ2 ) AS 体重大于XSZ2数,' +<br>&nbsp; &nbsp; &nbsp; &nbsp; 'sum(体重大于XS) &nbsp; &nbsp;AS 体重大于XS数,' +<br>&nbsp; &nbsp; &nbsp; &nbsp; 'sum(体重小于XSf2 ) AS 体重小于XSf2数,' +<br>&nbsp; &nbsp; &nbsp; &nbsp; 'sum(身高大于XSZ2 ) AS 身高大于XSZ2数,' +<br>&nbsp; &nbsp; &nbsp; &nbsp; 'sum(身高大于XS) &nbsp; &nbsp;AS 身高大于XS数,' +<br>&nbsp; &nbsp; &nbsp; &nbsp; 'sum(身高小于XSf2 ) AS 身高小于XSf2数 '+<br>&nbsp; &nbsp; &nbsp; ' from tj_record group by 年龄组,性别';<br><br>&nbsp; &nbsp; sqlserverselect = 'select 年龄组,性别,count(*) as 受检人数,' +<br>&nbsp; &nbsp; &nbsp; &nbsp; 'sum(case when 低体重+消瘦+发育迟缓+严重营养不良=0 then 1 else 0 end ) as 正常数,' +<br>&nbsp; &nbsp; &nbsp; &nbsp; 'sum(case when 低体重+严重营养不良=2 then 0 else 低体重 end ) AS 低体重数,' +<br>&nbsp; &nbsp; &nbsp; &nbsp; 'sum(消瘦 ) AS 消瘦数,' +<br>&nbsp; &nbsp; &nbsp; &nbsp; 'sum(发育迟缓 ) AS 发育迟缓数,' +<br>&nbsp; &nbsp; &nbsp; &nbsp; 'sum(严重营养不良 ) AS 严重营养不良数,' +<br>&nbsp; &nbsp; &nbsp; &nbsp; 'sum(体重大于XSZ2 ) AS 体重大于XSZ2数,' +<br>&nbsp; &nbsp; &nbsp; &nbsp; 'sum(体重大于XS) &nbsp; &nbsp;AS 体重大于XS数,' +<br>&nbsp; &nbsp; &nbsp; &nbsp; 'sum(体重小于XSf2 ) AS 体重小于XSf2数,' +<br>&nbsp; &nbsp; &nbsp; &nbsp; 'sum(身高大于XSZ2 ) AS 身高大于XSZ2数,' +<br>&nbsp; &nbsp; &nbsp; &nbsp; 'sum(身高大于XS) &nbsp; &nbsp;AS 身高大于XS数,' +<br>&nbsp; &nbsp; &nbsp; &nbsp; 'sum(身高小于XSf2 ) AS 身高小于XSf2数 '+<br>&nbsp; &nbsp; &nbsp; ' from tj_record group by 年龄组,性别';<br>这句sql 换做oracle 应该杂个写!????????
 
用sqlserverselect 的语句就可以
 
接受答案了.
 
后退
顶部