Jump to content

Recommended Posts

Hello,

 

I need your help. I have two different tables, where I would like to copy coumns values from a specific column in table 1 to a apsecific column in table 2. But it should copy with condition. E.g.

 

Tabe1

id | date  |

---------------

0  |  23-05-2013

1  |  10-04-2013

2  |  02-01-2013

4  |  04-04-2013

40  |  04-03-2013

 

Table2

id | date |

---------------

1 |  0-0-0000

2 | 0-0-0000

3 | 0-0-0000

4 | 0-0-0000

40 | 0-0-0000

 

So I would like to copy column Table1.data to column Table2.data where Table1.id = Table2.id.

 

The problem might be, that both tables have different id entries. But all ids which are in table1 and table2 should be used for replacement of the associated data field.

 

So the result should be

 

Table2

id | date |

---------------

1 | 10-04-2013

2 | 02-01-2013

3 | 0-0-0000

4 | 04-04-2013

40 | 04-03-2013

 

Is this possible with a MySQL statement?

Edited by payon
Link to comment
https://forums.phpfreaks.com/topic/279698-copy-columns-data-with-condition/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.