给定sql数据库工作区
Test(num int(4))
请用一个sql返回num的最大值,不允许用Max,Min

解决方案 »

  1.   

    select num from (select num from test order by num desc) where rownum=1
      

  2.   

    能不能select num from test where rownum=1 order by num desc
      

  3.   

    你的试过也可以,方法很多,如:select a.num from test a where not exists (select b.num  from test b where b.num  >a.num );
      

  4.   


    SELECT num FROM test t WHERE NOT EXISTS(SELECT num FROM test te WHERE te.num>t.num) AND t.num IS NOT NULL;