4 Replies - 3465 Views - Last Post: 05 August 2012 - 08:22 PM Rate Topic: -----

#1 austincr48  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 31-July 12

Copy values into another table

Posted 05 August 2012 - 07:43 PM

Hello,
I've been trying to figure out how I can select someone's favorite food and copy it to another table, which contains more than just the previous table's information already. Attached is my cheap mockup of what I need to do. Im not sure how to do it for every item in the table on the left. Is there a simple way of doing this? Thanks again!
-Austin

My apologies. Of course, Im using SQL for this.

Attached image(s)

  • Attached Image

Is This A Good Question/Topic? 0
  • +

Replies To: Copy values into another table

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9570
  • View blog
  • Posts: 36,240
  • Joined: 12-June 08

Re: Copy values into another table

Posted 05 August 2012 - 07:54 PM

It's a basic insert from a select.
Insert into <table name-destination> (column names)
Select (column names)
From <table name -source>


Was This Post Helpful? 1
  • +
  • -

#3 austincr48  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 31-July 12

Re: Copy values into another table

Posted 05 August 2012 - 08:00 PM

Sorry, I forgot to mention that the user will have already been in the second table. Would this work?
UPDATE INTO <destination_table> SET FavFood='TACO' WHERE FirstName='FirstName' AND LastName='LastName'

Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9570
  • View blog
  • Posts: 36,240
  • Joined: 12-June 08

Re: Copy values into another table

Posted 05 August 2012 - 08:14 PM

Yeah then use a join. Msdn has a great example under the general update help page.
Was This Post Helpful? 1
  • +
  • -

#5 austincr48  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 31-July 12

Re: Copy values into another table

Posted 05 August 2012 - 08:22 PM

Ohhhhh i completely forgot about that sorry i hsvent done much sql in quite some time thanks again!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1