这是我的一条语句:
SELECT WRY.*, WRY.WRYBH WRYBH2, fdrq,
  FROM T_WRY_JBXX WRY
  LEFT JOIN T_WRY_GLSX GLSX ON GLSX.WRYBH = WRY.WRYBH
 inner join (select wryjbxx.wrybh wryjbxx, max(jftzs.JFZZRQ) fdrq
               from t_wry_jbxx wryjbxx
              inner join t_jcgl_pwsf_jftzs jftzs on wryjbxx.wrybh =
                                                    jftzs.wrybh
              where jftzs.fdrq is not null
              group by wryjbxx.wrybh) c on c.wryjbxx = wry.wrybh
 WHERE GLSX.SFQXGL = '0'
   AND NVL(GLSX.SFKZPWF, '0') = '1'现在我要查表t_wry_jbxx中的sgdwmc这列,请问语句怎么写啊??

解决方案 »

  1.   

    SELECT WRY.WRYBH WRYBH2, c.fdrq, c.sgdwmc
      FROM T_WRY_JBXX WRY
      left join t_wry_glsx glsx on glsx.wrybh = wry.wrybh
     inner join (select wryjbxx.wrybh wryjbxx, max(jftzs.JFZZRQ) fdrq, wryjbxx.sgdwmc
      from t_wry_jbxx wryjbxx
      inner join t_jcgl_pwsf_jftzs jftzs on wryjbxx.wrybh =
      jftzs.wrybh
      where jftzs.fdrq is not null
      GROUP BY wryjbxx.wrybh, wryjbxx.sgdwmc) c on c.wryjbxx = wry.wrybh
     WHERE GLSX.SFQXGL = '0'
      AND NVL(GLSX.SFKZPWF, '0') = '1'
      

  2.   

    那就写WRY.sgdwmc罢,有问题吗?