Re: copy some values between rows

2012-08-23 Thread Elim Qiu
mysql> update student t1, student t2 -> set t1.gpa = t2.gpa -> where t1.id=5 and t2.id=1; Query OK, 1 row affected (0.36 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> select * from student; +++--+ | id | name | gpa | +++--+ | 1 | Bob | 4.0 | |

copy some values between rows

2012-08-23 Thread Elim Qiu
Consider two rows with id m and n in a table tb with a column cl, what's the sql command to set the value of cl in row n the same as that in row m? Below is my testing mysql> desc student; +---+--+--+-+-++ | Field | Type | Null | Key | Defau