[eluser]RobertB.[/eluser]
Thanks for taking the time.
This is the only way that I have being able to make it work. As you can see I have to use the dbprefix in the query.
This way inserts all the ids of table 1 into a column in table 2.
Code:
$this -> db -> query("INSERT INTO dbprefix_tbl2 (tbl2.tbl1_id) SELECT tbl1.id FROM dbprefix_tbl1;");
The way that you suggest only insert 1 record.
Code:
$this -> db -> insert('tbl2', array('tbl2.tbl1_id' => 'SELECT tbl1.id FROM tbl1'));
Thanks