select filepath from zqf_tmp 
       where jm_typeid=1
       order by dbms_random.value这句正常,每次查询结果都变. 但是,我加上个条件就提示缺少右括号,哪的问题啊?select name from jm_info where filepath in
(
select filepath from zqf_tmp 
       where jm_typeid=1
       order by dbms_random.value
)

解决方案 »

  1.   

    再套一层就好了
    select name
      from jm_info
     where filepath in (select filepath
                          from (select filepath, dbms_random.value val
                                  from zqf_tmp
                                 where jm_typeid = 1
                                 order by val))
      

  2.   

     (select filepath 
                          from (select filepath, dbms_random.value val 
                                  from zqf_tmp 
                                where jm_typeid = 1 
                                order by val))执行这段,还是每次查询结果都不一样,联就不行了
      

  3.   

    奇怪.我加了个条件,只取20条,就开始变化了select name 
      from jm_info 
    where filepath in (select filepath 
                          from (select filepath, dbms_random.value(1,50) val 
                                  from zqf_tmp 
                                where jm_typeid = 1 and rownum<=32
                                order by val))
    不明白.