id    name   sex
   1    张三    女
   1    张四    男
   3    王五    女 需要查询结果
  1    张三    女
  3    王五    女 或者
   1    张四    男
   3    王五    女只要id 相同的只要出来一个就性

解决方案 »

  1.   

    oracle没学过,你可以先查 select distinct id form table;查出不重复的ID,再一个一个查数据好了
      

  2.   

    select max(id) from table order by id
      

  3.   

    就是一个SQL语句呀,select max(id) from table order by id
      

  4.   

    不是吧???select max(id) from table order by id这样可吗?不就是找再大的id的记录吗?
      

  5.   


    select * from tablename where id=(select distinct id form tablename);
      

  6.   

    select distinct id form tableA
      

  7.   

    select peid,name,sex ,id from tt where id in (
    select id from ((select  max(id) as id, peid from tt group by peid))
    )已经解决
      

  8.   

    select * from (select * from tt group by id)