Does sql server minds the way records where inserted?
问题 (a "How it works" - question) Suppose I have this table : Id val ------------------ 1 a <-- 1 a 1 a 2 b <-- 2 b 2 b Now lets say I want the marked rows : Can I count on this query : select id,val from ( select id , val , row_number() over (partition by id order by id) as rn ) k where rn=1 to give me the Selected rows ? (notice the order by clause). will it consider the order as the order they were inserted ? 回答1: The behaviour is not guaranteed. Your query will return two rows, but which ones