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.