Link to home
Start Free TrialLog in
Avatar of samprg
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
Avatar of strickdd
strickdd
Flag of United States of America image

ASKER CERTIFIED SOLUTION
Avatar of almander
almander

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of samprg
samprg

ASKER

Nice, but I need to update F1 with number
Thanks

Result:
f1         f2
coca   coca1
coca   coca2
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of samprg

ASKER

Good, I wanna
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)
SOLUTION
Avatar of Brendt Hess
Brendt Hess
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ah, for the ability to edit.  You don't actually need to return ItemName from the Filt query...
Avatar of samprg

ASKER

Thank you