samprg
asked on
sql query
Hi,
I have a duplicate in item's name, so I want to add number 1,2,3,.. for any duplicate
on new field
Result:,Thanks
f1 f2
coca coca1
coca coca2
I have a duplicate in item's name, so I want to add number 1,2,3,.. for any duplicate
on new field
Result:,Thanks
f1 f2
coca coca1
coca coca2
http://msdn.microsoft.com/en-us/library/ms186734.aspx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Nice, but I need to update F1 with number
Thanks
Result:
f1 f2
coca coca1
coca coca2
Thanks
Result:
f1 f2
coca coca1
coca coca2
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Good, I wanna
1-Update statemnet
2- Just for duplicate
1-Update statemnet
2- Just for duplicate
UPDATE myTable
Set
Column1 = Value1
WHERE
F1 IN (SELECT F1,
F2 + Row_Number() OVER(PARTITION BY F1 ORDER BY F1)
FROM YOUR_TABLE_NAME)
Set
Column1 = Value1
WHERE
F1 IN (SELECT F1,
F2 + Row_Number() OVER(PARTITION BY F1 ORDER BY F1)
FROM YOUR_TABLE_NAME)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Ah, for the ability to edit. You don't actually need to return ItemName from the Filt query...
ASKER
Thank you