如何用一个SQL查询出一个班级各个学科第N名是谁? 首先贴出建表语句,方便大家本地测试: -- 建表语句 CREATE TABLE score ( id INT NOT NULL auto_increment, `name` VARCHAR (20) NOT NULL DEFAULT '' COMMENT '姓名', sub VARCHAR (20) NOT NULL DEFAULT '' COMMENT '学科', score INT NOT NULL DEFAULT 0 COMMENT '分…
--SQL查询每个表的字段数量select b.[name], count(*) As AllCount,ISNULL(ISNULL(sum(case when isnullable=0 then 1 end),null),null) as NotNullCountfrom syscolumns aINNER JOIN( select [id], [name] from [sysobjects] where [type] = 'u' ) AS b ON a.id = b.[id] GROUP b…