|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hello,
I have a problem in running an "insert..select" command to move data from one table to another. Namely, I have this two tables in my database, say "table1" and "table2", with a certain number of columns, among which: ====== table1 ====== .... author title journal link_ref adslink linkimage .... ====== table2 ====== .... authors title journal cmdiagrams adslink linkima .... and I try to run this command (via SQL box into phpMyAdmin): $ insert into table2 (authors,title,journal,cmdiagrams,adslink,linkima) select (author,title,journal,link_ref,adslink,linkimage) from table1; but I obtain the following error code: #1241 - Operand should contain 1 column(s) Admittedly, I can't understand what is the problem with the columns.. Could anyone give me a hint? (i've checked the mysql online manual, but I was not able to find more info..) Thanks in advance for any . Marco C. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On 1 Oct, 11:20, mcastell <mcas...@gruppolocale.it> wrote:
> Hello, > > I have a problem in running an "insert..select" command to move data > from one table to another. Namely, I have this two tables in my > database, say "table1" and "table2", with a certain number of columns, > among which: > > ====== > table1 > ====== > ... > author > title > journal > link_ref > adslink > linkimage > ... > > ====== > table2 > ====== > > ... > authors > title > journal > cmdiagrams > adslink > linkima > ... > > and I try to run this command (via SQL box into phpMyAdmin): > > $ insert into table2 > (authors,title,journal,cmdiagrams,adslink,linkima) > select (author,title,journal,link_ref,adslink,linkimage) > from table1; > > but I obtain the following error code: > #1241 - Operand should contain 1 column(s) > > Admittedly, I can't understand what is the problem with the columns.. > Could anyone give me a hint? > > (i've checked the mysql online manual, but I was not able to find more > info..) > > Thanks in advance for any . > > Marco C. You can't have looked very hard then. The section entitled "INSERT ... SELECT Syntax" (http://dev.mysql.com/doc/refman/5.0/...rt-select.html) shows the syntax of an INSERT SELECT command (amazing huh!) and gives an example at the very top of the page. Your query doesn't look like the example. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On 1 Ott, 13:27, Captain Paralytic <paul_laut...@yahoo.com> wrote:
> (...) > Your query doesn't look like the example. Ops, thanks a lot! I did check the quoted page several times, but still I had not understood that I could NOT have the brackets following the select... my fault! ![]() Greetings, Marco |
|
![]() |
| Outils de la discussion | |
|
|