Reputation: 4767
What would be the correct syntax to do the following in mysql?
SET @inc = 1;
update platform set package_id=(@inc := 1) where platform != 'hello';
Basically, I just want to create a pseudo-auto-incrementing field here, but it seems this just sets everything to 1
. What would be the proper way to do this?
Upvotes: 0
Views: 31
Reputation: 4767
Set it like this:
SET @inc = 0;
update platform set package_id=(@inc := @inc + 1) where platform != 'hello';
Upvotes: 2