select distinct trunc(sysdate) + level - 1,level days 
  from dual 
  connect by trunc(sysdate) + level - 1 < = trunc(sysdate+10);
  
  select trunc(sysdate) + level - 1,level days 
  from dual 
  connect by trunc(sysdate) + level - 1 < = trunc(sysdate+10);
  
  select distinct level, rownum from dual
  connect by rownum <=10;
  
    select rownum,level m from dual
  connect by rownum <= 10;
为什么加了distinct以后执行的结果就乱序了呢?

解决方案 »

  1.   

    为什么要加distinct呢?
    如果想不排序就order by再次排序罢。
      

  2.   


    你好!我就是想问为什么查询结果的次序会变,当加了distinct以后!
      

  3.   

    DISTINCT | UNIQUE 
    Specify DISTINCT or UNIQUE if you want the database to return only one copy of each set of duplicate rows selected. These two keywords are synonymous. Duplicate rows are those with matching values for each expression in the select list.Restrictions on DISTINCT and UNIQUE Queries These types of queries are subject to the following restrictions:•When you specify DISTINCT or UNIQUE, the total number of bytes in all select list expressions is limited to the size of a data block minus some overhead. This size is specified by the initialization parameter DB_BLOCK_SIZE.•You cannot specify DISTINCT if the select_list contains LOB columns.我查了一下Oracle联机文档也没搞明白!结贴!