没有什么要求,就查询出所有的数据换一种说法,比如我用select distinct(A) from table 只能显示出字段A,但是我希望把所有的数据都显示出来(A不能重复)

解决方案 »

  1.   

    select distinct A,B,C...from table tableName;
    Distinct
    用途:
     DISTINCT关键字被用作返回唯一的值
    语法:
    SELECT DISTINCT column-name(s) FROM table-name
    解释:
     当column-name(s)中存在重复的值时,返回结果仅留下一个
      

  2.   

    请问用select distinct A,B,C...from table tableName的话,B会有重复数据吗?
      

  3.   

    select min(b),a from table group by a;
      

  4.   

    看来是我表达的不好,这样说吧:
    table(大写字母为字段名,小写字母为具体数据)
    -----------------
    A   B   C   D   E
    - - - - - - - - - 
    1   b   c   d   e
    2   c   c   d   c
    2   d   d   a   c
    4   c   b   b   b
    4   c   c   c   d现在A字段里面有数据重复,我要求查询结果:-----------------
    A   B   C   D   E
    - - - - - - - - - 
    1   b   c   d   e
    2   c   c   d   c
    4   c   b   b   b
      

  5.   

    select * from (select a.*,row_number() over(partition by a order by rownum) rm from tab a) where rm=1
      

  6.   

    select * from table_name group by A
    group by 就是按指定字段归类,A不重复显示。