1樓:
select max(id) as id,max(bigclassname) as bigclassname,bm from table where bigclassname='2001' group by bm
2樓:匿名使用者
select * from table where id in (select max(id) from table group by bm where bigclassname='2001')
3樓:匿名使用者
select max(id) as id, max(bigclassname) as bigclassname, bm
from 表名 where (bigclassname = '2001')
group by bm
4樓:
select id,bigclassname,bm from table where bigclassname='2010' group by bm
5樓:泗縣人在北京
select distinct bm from 表名 where bigclassname=2001
求一條SQL語句
樓上兩位的都有問題。應該是 select a.tid,tkh,tname,sum t2a sum t2b from table1 a,table2 bwhere a.tid b.tid and tkh 50 group by a.tid,tkh,tname select table1.tid,tkh...
求一條SQL語句
select from select from 表 where 列2 is null union select from 表 where 列2 is not null and rownum 100 case when select count from 表 where 列2 is null 100 ...
求一條SQL語句,有關聯合查詢的
試試看這樣行不行 select 表b 學號 表a 姓名 isnull sum case 表b 學科 when n 語文 then 表b 分數 end 0 as 語文 isnull sum case 表b 學科 when n 數學 then 表b 分數 end 0 as 數學 isnull sum c...