"Ricardo Lopes" <[EMAIL PROTECTED]> wrote:
> I have to copy some records from one table into the same table is it
> posible?
> 
> my sql is like this:
> 
> INSERT INTO equipamento_componentes (cod_equipamento_componentes, cod_tipo,
> numero, data_colocacao, cod_componente)
> 
> SELECT '', 'C', 65, NOW(), EQ.cod_componente
> 
> FROM equipamento_componentes EQ
> 
> WHERE (EQ.cod_tipo='C' and EQ.numero=1)
> 
> 
> 
> The table is like this:
> 
> cod_equipamento_componentes         int        auto_increment
> 
> cod_tipo                                                char
> 
> numero                                                    int
> 
> data_colocacao                                    date
> 
> cod_componente                                    int (FK references another
> table)
> 
> 
> 
> I get an erro saying that i cannot use that table in the select, the table
> is a InnoDB.
> 
> Can i use the same table in the insert into select? do i have to use a
> temporary table?
> 

What version do you use?
You can insert data in to the same table as you use in the  SELECT part from version 
4.0.14:
        http://www.mysql.com/doc/en/INSERT_SELECT.html



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to