1 Replies - 147 Views - Last Post: 12 December 2018 - 08:05 AM

#1 EndLessMind   User is offline

  • Android Expert
  • member icon

Reputation: 273
  • View blog
  • Posts: 1,252
  • Joined: 13-March 09

Get column content from one table and use it to get id from other tabl

Posted 12 December 2018 - 07:52 AM

Sorry for the bad description, not sure what to call this.

I'm trying to migrate a bad database structure to a better one.
The old storage, lets say customer name in say invoice table.
The new I going to need a ref to customer-table so that more information about the customer can be queried if needed.

So, to not completely break all the old entries, I would like a query that take col2,col3,col4 from tbl1 and and queries tbl2,tbl3 and tbl4 to get and ID of
each of the content of the columns.

Then I would want to update the row in tbl1 with these ID's in their respectable column.

The thing is, I have no idea about how to do this.
I don't even know what to search for to learn about it.

Thanks in advance

This post has been edited by EndLessMind: 12 December 2018 - 07:52 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Get column content from one table and use it to get id from other tabl

#2 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4228
  • View blog
  • Posts: 13,401
  • Joined: 08-June 10

Re: Get column content from one table and use it to get id from other tabl

Posted 12 December 2018 - 08:05 AM

You're looking for a multi-table update. Cf. https://dev.mysql.co.../en/update.html
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1