Keep It Simple, Stupid | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Can you swap two values in SQL in one statement?
For instance, if I have records with an "order" value, and want to swap six and five around so that six becomes five and five becomes six, can I do it in one statement? I'm not in a position to test this at the moment. I was thinking you'd have to temporarily set the "order" value five to null, or a million or something, then make six into five and the temporarily-changed record into six. Because if you do it like this:
then you're just going to end up with two sixes, aren't you? And if you do "limit =1" then you don't know which one you're going to get. In reply to non-perl SQL question by Anonymous Monk
|
|