这个SQL怎么写?

[复制链接]
查看11 | 回复5 | 2012-7-3 11:53:31 | 显示全部楼层 |阅读模式
selectt1.*from table1 t1,(selectclassno,max(studentno )as studentnofrom table1 group by classno ) t2where t1.classno=t2.classnoand t1.studentno=t2.studentno...
回复

使用道具 举报

千问 | 2012-7-3 11:53:31 | 显示全部楼层
SELECT a.* FROM table1 a INNER JOIN (SELECT MAX(StudentNO),ClassNO AS MaxStudentNO FROM table1 GROUP BY ClassNO) TON a.StudentNO=T.StudentNOAND a.ClassNO=T.ClassNO...
回复

使用道具 举报

千问 | 2012-7-3 11:53:31 | 显示全部楼层
上面2个都行,我就不写了...
回复

使用道具 举报

千问 | 2012-7-3 11:53:31 | 显示全部楼层
select max(studentno),studentnamefrom table1 group by classno...
回复

使用道具 举报

千问 | 2012-7-3 11:53:31 | 显示全部楼层
select max(studentno)from table1 where classno in(1,2) group by classno...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行