Jump to content


Photo

*solved* How to move One table values to another table (with one extra field)


  • Please log in to reply
2 replies to this topic

#1 rajmohan

rajmohan
  • Members
  • PipPipPip
  • Advanced Member
  • 169 posts

Posted 20 September 2006 - 05:45 AM

Hello guy

I am having two tables fields followed by

table1

one
two
three

table2
one
two
three
four

I want to move the values from table1 to table2
mysql_query("insert into table2(select * from table1 where id='1'");

it is not working how to write a query please help me



#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 20 September 2006 - 06:19 AM

insert into table2 (one, two, three) select * from table1 where id='1'"
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#3 rajmohan

rajmohan
  • Members
  • PipPipPip
  • Advanced Member
  • 169 posts

Posted 20 September 2006 - 06:35 AM

Yes working thanks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users