select top 1 * from course where c2id in (select min(c2id) from course )
select * from course C where not exists(select 1 from course where cid=C.cid and c2id<C.c2id)
select * from [course] where c2id = (select top 1 c2id from course order by c2id asc)
select * from course where c2id in(select min(c2id) from course)
select top 1 * from course order by c2id asc
select * from table where c2id in(select min(c2id) as c2id from table)
/* 表 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)
select a.* from course a where not exists (select * from course where id = a.id and c2id<a.c2id)
select * from course a where (select count(*) from course where cid=a.cid and clid=a.clid and c2id<a.c2id)<1
where not exists(select 1 from course where cid=C.cid and c2id<C.c2id)
select * from [course] where c2id = (select top 1 c2id from course order by c2id asc)
select * from table
where c2id in(select min(c2id) as c2id from table)
表 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)
select a.* from course a where not exists (select * from course where id = a.id and c2id<a.c2id)
where (select count(*) from course where cid=a.cid and clid=a.clid and c2id<a.c2id)<1