SELECT ROW_NUMBER()OVER(PARTITION By GroupId ORDER BY GroupId ) CN, * FROM T_DIM_SENSOR_GROUP
select * from (
SELECT ROW_NUMBER()OVER(PARTITION By GroupId ORDER BY GroupId ) Cu, * FROM T_DIM_SENSOR_GROUP) t where t.Cu<2