请问:sql中的
update a  set a.mrts ==DATEDIFF(day,a.cdrq,b.rq) from FD_DAIRYCENTER.rep_gtzhqk a , FD_DAIRYCENTER.YZFZ_GNYW b 
     where a.nh = b.nh and a.tc = b.tc and b.gnrq is not null;如何改为oracle语句?

解决方案 »

  1.   

    update a  set a.mrts =(TO_DATE(a.cdrq,'YYYY-MM-DD')-TO_DATE(b.rq,'YYYY-MM-DD')) from FD_DAIRYCENTER.rep_gtzhqk a , FD_DAIRYCENTER.YZFZ_GNYW b 
         where a.nh = b.nh and a.tc = b.tc and b.gnrq is not null;
      

  2.   

    可是问什么在from这个地方提示sql没有正确结束呢?
      

  3.   

    update a  set a.mrts=(select  DATEDIFF(day,a.cdrq,b.rq) from  FD_DAIRYCENTER.YZFZ_GNYW b 
         where a.nh = b.nh and a.tc = b.tc and b.gnrq is not null)
    where exists(select 1 from FD_DAIRYCENTER.YZFZ_GNYW b where a.nh = b.nh and a.tc = b.tc and b.gnrq is not null);
      

  4.   

    问一下where exists(select 1 from FD_DAIRYCENTER.YZFZ_GNYW b where a.nh = b.nh and a.tc = b.tc and b.gnrq is not null);是什么意思?起什么作用啊?
      

  5.   

    update a  set a.mrts=(select  DATEDIFF(day,a.cdrq,b.rq) from  FD_DAIRYCENTER.YZFZ_GNYW b 
         where a.nh = b.nh and a.tc = b.tc and b.gnrq is not null)
    where exists(select 1 from FD_DAIRYCENTER.YZFZ_GNYW b where a.nh = b.nh and a.tc = b.tc and b.gnrq is not null);where exists(select 1 from FD_DAIRYCENTER.YZFZ_GNYW b where a.nh = b.nh and a.tc = b.tc and b.gnrq is not null);是子查询控制,update的数据集合范围
      

  6.   

    顺便问一下
    select '12' as mrybh,'12月'as mry into mrymc
    insert into mrymc select '2' ,'02月'
    在oracle中怎么实现?
      

  7.   

    insert into mrymc select '2' ,'02月'
    在oracle中怎么实现?==================================insert into mrymc select '2','02月' from dual