Jump to content

mysql increment/decrement on command with a condition


DamienRoche

Recommended Posts

Ok, so I want to increment/decrement a col (qid) but only after a certain number....

 

qid

1

2

3

4

5

 

I'm looking for a way to increment 3,4,5 to become 4,5,6 - by using an anchor that says increment all numbers after #num.

 

Is that possible?

 

Also, I want to be able to decrement numbers - so say, decrement 4,5 to become 4,3. NOTE: dupes don't matter.

 

Is this possible?

 

I need to be able to do this with mysql syntax within php, not phpmyadmin.

 

I've searched but I just can't find anything that allows me to specify exactly where to increment/decrement.

 

Any help greatly appreciated.

 

Thanks.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.