select t.c_measuredocid,
       t.c_carrytoolmainid,
       t.i_msrfinishflag,
       (select d.n_tareweight / 1000, d.c_taredatetime
          from tmsr_measuredata d
         where d.c_measuredocid = t.c_measuredocid
           and d.n_tareweight <> 0),
       (select d.n_grossweight / 1000, d.c_grossdatetime,
          from tmsr_measuredata d
         where d.c_measuredocid = t.c_measuredocid
           and d.n_grossweight <> 0),
       t.n_suttleweight / 1000,
       t.c_suttleweightdate
  from TMSR_MEASUREDOCINFO t and t.c_measuredocid = 'Q140801133358015'

解决方案 »

  1.   

    上面那个有点问题:
    select t.c_measuredocid,
           t.c_carrytoolmainid,
           t.i_msrfinishflag,
           t1.n_tareweight / 1000,
           t1.c_taredatetime,
           t2.n_grossweight / 1000,
           t2.c_grossdatetime,
           t.n_suttleweight / 1000,
           t.c_suttleweightdate
      from TMSR_MEASUREDOCINFO t,
           (select d.c_measuredocid, d.n_tareweight / 1000, d.c_taredatetime
              from tmsr_measuredata d
             where d.n_tareweight <> 0) t1,
           (select d.c_measuredocid, d.n_grossweight / 1000, d.c_grossdatetime
              from tmsr_measuredata d
             where d.n_grossweight <> 0) t2
     where t1.c_measuredocid = t.c_measuredocid
       and t2.c_measuredocid = t.c_measuredocid
       and t.c_measuredocid = 'Q140801133358015'
      

  2.   

    上面那个有点问题:
    select t.c_measuredocid,
           t.c_carrytoolmainid,
           t.i_msrfinishflag,
           t1.n_tareweight / 1000,
           t1.c_taredatetime,
           t2.n_grossweight / 1000,
           t2.c_grossdatetime,
           t.n_suttleweight / 1000,
           t.c_suttleweightdate
      from TMSR_MEASUREDOCINFO t,
           (select d.c_measuredocid, d.n_tareweight / 1000, d.c_taredatetime
              from tmsr_measuredata d
             where d.n_tareweight <> 0) t1,
           (select d.c_measuredocid, d.n_grossweight / 1000, d.c_grossdatetime
              from tmsr_measuredata d
             where d.n_grossweight <> 0) t2
     where t1.c_measuredocid = t.c_measuredocid
       and t2.c_measuredocid = t.c_measuredocid
       and t.c_measuredocid = 'Q140801133358015'

    谢谢,成功了~~~~