Is ordering important for the <value> field ?Is <value> unique for each id?CREATE TABLE T (ID INT, Value VARCHAR(30) ) ----------INSERT INTO T SELECT 4, 'spring' UNION ALLSELECT 4, 'winter' UNION ALLSELECT 4, 'summber' UNION ALLSELECT 11, 'east' UNION ALLSELECT 11, 'west' UNION ALLSELECT 13, 'east' UNION ALLSELECT 14, 'north'select n seq,id,valuefrom( select top 100 percent t1.id,t1.value,(select count(1) from t t2 where id = t1.id and t1.value <= t2.value) n from t t1 order by t1.id,t1.value) dorder by id,n,valuedrop table t