![]() | |
#1
| |||
| |||
|
|
How can I swap two records in a table without using a temporary record to store the content of one of them? Let's say I have: Index|some string value -----+----------------------- 1| sample string 2|another sample string and I want to have Index|some string value -----+----------------------- 1|another sample string 2| sample string Any ideas? |
#2
| |||
| |||
|
|
Update Table set Index = 3 - Index where Index in ( 1, 2 ) |
#3
| |||
| |||
|
|
"Bob Badour" <bbadour (AT) golden (DOT) net> writes: Update Table set Index = 3 - Index where Index in ( 1, 2 ) Hmm...you noticed [mysql] in the subject line and knew you wouldn't have to worry about ON UPDATE CASCADE. Is this cheating? :-) |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
What does ON UPDATE CASCADE have to do with a single table update statement? |
|
unless one applies the closed world assumption, anything is possible. |
#6
| |||
| |||
|
|
"Bob Badour" <bbadour (AT) golden (DOT) net> writes: Update Table set Index = 3 - Index where Index in ( 1, 2 ) Hmm...you noticed [mysql] in the subject line and knew you wouldn't have to worry about ON UPDATE CASCADE. Is this cheating? :-) |
![]() |
| Thread Tools | |
| Display Modes | |
| |