我有一个简单的SELECT语句需要序列号根据结果(不需要分组或排序)我使用了Row_Number,但它需要结束。任何其他方法来做到这一点?请帮助
SELECT
ROW_NUMBER() OVER () AS ArrayId (:here i need sequence number)
, TRIM(CM.Category) as Category
, TRIM(CM.SubCategory) as SubCategory
, CM.PlantCode
, ISNULL(PM.PlantName,'') as PlantName
, CM.Capacity AS Capacity_
, CM.SizeRange
, CM.CapacityId
FROM capacitymaster2 CM
LEFT JOIN PlantMaster2 PM ON CM.PlantCode = PM.PlantCode
WHERE CM.SubCategory IS NOT NULL AND CM.SubCategory != ''
1条答案
按热度按时间c0vxltue1#
如果需要唯一的序列号,请尝试:
ROW_NUMBER() OVER (ORDER BY (SELECT NULL))
,但不关心实际顺序。