If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Copy table column to another table column?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-12-04, 02:39
bjarman.org bjarman.org is offline
Registered User
 
Join Date: Mar 2004
Posts: 3
Copy table column to another table column?

Hi!

I need to copy all values in one table column to the column in another table, where the ID's for each row in the first table is the same as the value in the column POST_ID in the new table, and the value in the column POST_TYPE in the new table is "CD", is this possible? I have com up with this, but it does not work. I am very new to mysql so there is probably basic errors in my code, please advice.
(searchindex = the table to receive data
POST_DATE = the column to receive data
cd = the table where the data resides
CD_DATE = the column where the data resides
POST_ID and POST_TYPE is together a unique identifier for a row in other tables)

INSERT INTO searchindex (POST_DATE ) SELECT CD_DATE FROM cd WHERE
ID=searchindex.POST_ID && searchindex.POST_TYPE="CD"

The above sql creates the error: Unknown table 'searchindex' in where clause
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On