select NVL((select waterpay.waterend 
                     from waterpay,input
                     where waterpay.userid=input.userid and rownum<=1 order by year,usemonth desc  ),'0')
                     from dual;
请问这句话错在哪里?该怎么写?

解决方案 »

  1.   

    select * from (select * from tbl1 order by col desc) tbl2 where rownum<=1
      

  2.   

    select nvl(waterpay.waterend,'0')
                         from waterpay,input
                         where waterpay.userid=input.userid and rownum<=1 order by year,usemonth desc
      

  3.   

    乔,向你这么写没错,但是我用在这里为什么就不对了呢?
    update input
    set waterreal=(select nvl(waterpay.waterend,'0')
    from waterpay,input
    where waterpay.userid=input.userid and rownum<=1 order by year,usemonth desc)
    where input.userid=0;
      

  4.   

    是不是类型不匹配呢?
    看你的WATERREAL是什么型的?