![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I want to combine the values ??????of the two fields are still in one table, with the command below : update kabupaten set id_kabupaten = ( select concat(prop_id, id_kabupaten) ) where prop_id = 11 but the above command if prop_id weakness is that I got there 50.000 values, it's not very efficient because I have to type them one by one. Please help so that commanded more efficient. Thanks b4 |
#3
| |||
| |||
|
|
On Sat, 23 Jul 2011 23:58:32 -0700 (PDT), zaqi syah wrote: I want to combine the values ??????of the two fields are still in one table, with the command below : update kabupaten set id_kabupaten = ( select concat(prop_id, id_kabupaten) ) where prop_id = 11 but the above command if prop_id weakness is that I got there 50.000 values, it's not very efficient because I have to type them one by one. Please help so that commanded more efficient. Thanks b4 No need for the WHERE clause, if you want all the rows so updated. Since this query is potentially destructive could be repeated and cause problems, you may wish to add another column to the table, concat() the values into that, and (when you are satisfied with the results), replace id_kabupaten via a single UPDATE kabupaten SET id_kabupaten = your_new_column and then drop your_new_column from the table. -- It is odd, but on the infrequent occasions when I have been called upon in a formal place to play the bongo drums, the introducer never seems to find it necessary to mention that I also do theoretical physics. * * * * * * * * --Feynman |
|
concat(a,b) | +-------------+ 11 | 22 | 33 | +-------------+ |
|
a | b | +------+------+ 1 | 1 | 22 | 2 | 3 | 3 | +------+------+ |
![]() |
| Thread Tools | |
| Display Modes | |
| |