I have a table named "Table1"
Its schema with data is like this
Id col2 col3 col4 col5 isUnique dbUnique
1 red 3M 1995 UK 1 null
2 red 3M 1995 UK 0 null
2 red 3M 1995 UK 0 null
3 red 3M 1995 UK 0 null
4 pink A4 2002 USA 1 null
5 pink A4 2002 USA 0 null
Now my question is that, that i want to update dbUnique column of this table, such that dbUnique should contain Id of Table1 where isUnique is 1 in all duplicate rows based on col2,col3,col4 & col5
So my updated data will look like this
Id col2 col3 col4 col5 isUnique dbUnique
1 red 3M 1995 UK 1 1
2 red 3M 1995 UK 0 1
2 red 3M 1995 UK 0 1
3 red 3M 1995 UK 0 1
4 pink A4 2002 USA 1 4
5 pink A4 2002 USA 0 4
this table has over 50,000 rows.
How can i do this in MS SQL 2008