Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
copy data from a column in table a into a column in table b!
Old 02-28-2009, 07:21 PM copy data from a column in table a into a column in table b!
Novice Talker

Posts: 14
Name: biklad
Trades: 0
I have a column called price in table a. and a column called price in table b - I am trying to figure how to make the column in table b be populated by the column in table a.

EXAMPLE

TABLE A TABLE B

price price
=== ===
50 (here i want the 50 from table a to appear automatically)
jcrensha627 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-28-2009, 08:23 PM Re: copy data from a column in table a into a column in table b!
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Code:
update b
set b.price=a.price
from srcTable as a
  inner join trgTable as b
    on a.id=b.id
This will do what you want to, but directly in SQL. No need of PHP for that.
Of course, you'll need to adapt the query to your schema structure.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Reply     « Reply to copy data from a column in table a into a column in table b!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.34434 seconds with 12 queries