表 course 中
 cid ,c1id,c2id  都是int 型 
获取 c2id  最小的那条记录 
谢谢 ~

解决方案 »

  1.   

    select top 1 * from course where c2id in (select min(c2id) from course )
      

  2.   

    select * from course C
    where not exists(select 1 from course where cid=C.cid and c2id<C.c2id)
      

  3.   


    select * from [course] where c2id = (select top 1 c2id from course order by c2id asc)
      

  4.   

    select * from course where c2id in(select min(c2id) from course)
      

  5.   

    select top 1 * from course order by c2id asc
      

  6.   


    select * from table
    where c2id in(select min(c2id) as c2id from table)
      

  7.   

    /*
    表 course 中 
    cid ,c1id,c2id  都是int 型 
    获取 c2id  最小的那条记录 
    */
    select * from course c where not exists (select * from cid=c.cid and clid=c.clid and c2id<c.c2id)
      

  8.   


    select a.* from course a where not exists (select * from course where id = a.id and c2id<a.c2id)
      

  9.   

    select * from course a
    where (select count(*) from course where cid=a.cid and clid=a.clid and c2id<a.c2id)<1