SELECT
PriceCatalogueID,Replace(Replace(ItemTitle,'%27',''''),'%22','"') as ItemTitle,
Replace(Replace(CategoryName,'%27',''''),'%22','"') as CategoryName,
Replace(Replace(Description,'%27',''''),'%22','"') as Description,
CustomerCode, AllocatedCustomer, ItemCode, Action
FROM
VW_productcatalogue_View L
WHERE
L.CompanyID = 2144
AND CategoryName LIKE '%plan%'
AND PriceCatalogueID IN (SELECT PriceCatalogueID
FROM tb_Pricecataloguecustomer
WHERE customerid IN (SELECT clientid
FROM tb_client
WHERE clientName LIKE '%nsw%'
AND companyID = 2144
AND isDelete = 0))
--order by L.PriceCatalogueID asc
ORDER BY
L.CategoryName ASC
OFFSET 0 ROWS
FETCH NEXT 50 ROWS ONLY;
这是由我的代码动态生成的查询。
在上面的查询中,如果完成了按L.CategoryName的订购,则仅FETCH NEXT 50 ROWS不能正常工作。
如果使用按L.PriceCatalogueID的订单,则查询工作正常。
如果使用L.CategoryName的订单,有人可以指导为什么这不起作用吗?