十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
sql1=select * from (select *, row_number() over(order by username ) as rowNumber from users where regfrom='admin') as t where t.rowNumber 0 and t.rowNumber = 0 + 30 order by username
在叙永等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供网站设计制作、网站制作 网站设计制作按需网站策划,公司网站建设,企业网站建设,品牌网站建设,成都全网营销推广,外贸网站建设,叙永网站建设费用合理。
怎么会有27 条记录呢,除非你的表 一共就27条记录吧。
用游标或临时表
--游标
declare youbiao1 for 查询1
open youbiao1
fetch next from youbiao1 into 变量
while @@FETCH_STATUS = 0
begin
里面一次套用
end
--临时表
declare @ID int
set @ID = 1
while Exists(select * from 表)
begin
--处理
--
set @ID = @ID + 1
end
Create Table Tb
(
Pid Varchar(50),
CEID Varchar(50),
Level int,
Ccode Varchar(50),
pCode Varchar(50)
)
Insert Into TB Values('','1',0,'产品1','')
Insert Into TB Values('1','2',1,'Test1','产品1')
Insert Into TB Values('1','3',1,'Test2','产品1')
Insert Into TB Values('2','4',2,'Test11','Test1')
Insert Into TB Values('2','5',2,'Test12','Test1')
Insert Into TB Values('3','6',2,'Test21','Test2')
Insert Into TB Values('3','7',2,'Test22','Test2')
Insert Into TB Values('6','8',3,'Test211','Test21')
Insert Into TB Values('6','9',3,'Test212','Test21')
Insert Into TB Values('6','10',3,'Test213','Test21')
With T
As
(
Select Pid,CEID,Ccode,Level,Convert(Varchar(4000),CEID) As Path From TB Where Pid=''
Union All
Select TB.Pid,TB.CEID,TB.Ccode,TB.Level,Convert(Varchar(4000),T.Path+'-'+TB.CEID) From TB inner join T On TB.Pid=T.CEID
)
Select replicate(' ',level)+Ccode As Ccode From T
Order By Path
--T_Sql查询
select a.Name as tableName from sysobjects a inner join syscolumns b on a.ID=b.ID
where b.Name='字段名'
给分!