现在有张表 schedule包含下面的字段和信息
cid, tid, classtime, classno
001 t0001 time1 no1
001 t0001 time2 no1
002 t0002 time1 no2
002 t0002 time2 no2向提取出
001 t0001
002 t0002 sql语句怎么查啊,谢谢各位!
cid, tid, classtime, classno
001 t0001 time1 no1
001 t0001 time2 no1
002 t0002 time1 no2
002 t0002 time2 no2向提取出
001 t0001
002 t0002 sql语句怎么查啊,谢谢各位!
select distinct cid,tid from tb
???
select distinct cid,tid from schedule group by cid
AND classtime>T.classtime )
select id,tid from schedule group by cid,tid
select cid,tid from schedule a where not exists(select 1 from a where cid=a.cid TID=T.TID and classtime>a.classtime )
select cid,tid from schedule a where not exists(select 1 from a where cid=a.cid and classtime>a.classtime )
SELECT DISTINCT cid,tid
FROM schedule
ORDER BY cid 2.
SELECT cid,tid
FROM schedule
GROUP BY cid,tid
ORDER BY cid
SELECT cid,tid
FROM schedule
GROUP BY cid,tid
ORDER BY cid
与
SELECT cid,tid
FROM schedule
GROUP BY cid,tid 有什么区别吗??我觉得效果是一样的
select id,tid from schedule group by cid,tid 或者select distinct cid,tid from table
AND classtime>T.classtime )
-------------------------------
正解
FROM schedule
ORDER BY cid
???
是这样???[[/code]
SELECT DISTINCT cid,tid
FROM schedule
ORDER BY cid
???
是这样??
select cid,sid from schedule group by cid,sid
select distinct cid,tid from tb
AND classtime>T.classtime )
select distinct cid,tid
from schedule
select id,tid from schedule group by cid,tid
--或者select distinct cid,tid from schedule
select distinct cid,tid from schedule感觉楼主没有把问题的所有条件说全。
select distinct cid,tid from tb
cid, tid, classtime, classno
001 t0001 time1 no1
001 t0001 time2 no1
002 t0002 time1 no2
002 t0002 time2 no2 向提取出
001 t0001
002 t0002 sql语句怎么查啊,谢谢各
select cid, tid from schedule
where cid<003