当前位置: 代码迷 >> Sql Server >> 各位大侠帮帮忙,问个数据查询方面的有关问题
  详细解决方案

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

热度:54   发布时间:2016-04-27 18:39:23.0
各位大侠帮帮忙,问个数据查询方面的问题
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)
  相关解决方案