alter proc getFrontMultipleRecords
@startingRow int, --起始行
@terminaRow int, --终止行
@queryCondition nvarchar(50) --查询条件
as
begin
select *
from (
select row_number() over (order by sgi.factoryNumber) as rowNum,
sgi.goodsBarCode,
sgi.goodsName,
gt.goodsType,
sgi.costPrice,
mfi.factoryName,
sgi.goodsNo,
sgi.storageAlarm
from SellGoodsInfo as sgi
Inner join ManufacturerInfo as mfi on sgi.factoryNumber = mfi.factoryNumber
Inner join GoodsType as gt on sgi.goodsTypeId = gt.goodsTypeId
where sgi.goodsName like '%'+@queryCondition+'%'
) as tbl where rowNum between @startingRow and @terminaRow
end
go
@startingRow int, --起始行
@terminaRow int, --终止行
@queryCondition nvarchar(50) --查询条件
as
begin
select *
from (
select row_number() over (order by sgi.factoryNumber) as rowNum,
sgi.goodsBarCode,
sgi.goodsName,
gt.goodsType,
sgi.costPrice,
mfi.factoryName,
sgi.goodsNo,
sgi.storageAlarm
from SellGoodsInfo as sgi
Inner join ManufacturerInfo as mfi on sgi.factoryNumber = mfi.factoryNumber
Inner join GoodsType as gt on sgi.goodsTypeId = gt.goodsTypeId
where sgi.goodsName like '%'+@queryCondition+'%'
) as tbl where rowNum between @startingRow and @terminaRow
end
go
把新代码中sgi. , gt. , mfi. 都改成 tbl. , 并且在tbl中添加相关的gt.goodsType,mfi.factoryName列即可。