首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

各位大侠帮帮忙,问个数据查询方面的有关问题

2012-01-11 
各位大侠帮帮忙,问个数据查询方面的问题create table uselogininfo(useid char(9) not null primary key,u

各位大侠帮帮忙,问个数据查询方面的问题
create table uselogininfo
(
useid char(9) not null primary key,
usename varchar(30) not null unique,
usepwd varchar(30) not null,
uselevel smallint not null--用户级别
)
直接以一个结果集的形式,将所有不同的用户级别取前两个用户的信息,以id号作为排序条件,我现在只能一个级别一个级别的取,不知道怎么做 


[解决办法]

SQL code
select *from uselogininfo uwhere useid in(select top 2 useid from uselogininfo where u.uselevel=uselevel order by useid) 

热点排行