How to perform auto-increment with dependency on column in SQL Server -
i trying figure out how auto-increment based on change in values in different column shown below
this getting right now
otherid | autoincrement --------+---------------       | 1       | 2  b       | 3 c       | 4 d       | 5 d       | 6 this hoping for
otherid | autoincrement --------+---------------       | 1       | 1  b       | 2 c       | 3 d       | 4 d       | 4 
try  using row_number()
select row_number() over(partition otherid  order  (select 1)),autoincrement mytable 
Comments
Post a Comment