有一个表  
 
aTable  
 
name    ¦  number  
-------------  
a                  2  
b                  3  
a                  1  
c                  9  
a                  6  
b                  3  
 
不能用groupby  不能用max等这些函数,怎么写查询语句查出  
a  b  c  中分别最大的  number  啊????

解决方案 »

  1.   

    Select * from aTable t where not exists
    (Select * from aTable where name=t.name and number>t.number)
      

  2.   

    嗯...最终结果应该是  
    a 6
    b 3
    c 9WangZWang(先来) 你给出的查询,
    a 6
    b 3
    b 3
    c 9有没有办法去掉重复的啊...
      

  3.   

    Select distinct * from aTable t where not exists
    (Select * from aTable where name=t.name and number>t.number)
      

  4.   

    Select   distinct   *   from   aTable   t   where   not   exists 
    (Select   *   from   aTable   where   name=t.name   and   number> t.number) 
    order by t.number desc;
    c   9
    a   6 
    b   3