mercredi 6 juillet 2016

How to make MYSQL column equal to select query

sorry if it is a basic question but I am new to mysql, I have two tables one of them is for CustomerID vs address while the second is CustomerID vs transaction.

I want to add column in the second table for the address and make this column always select the address from the first table using the customer ID and write it. so that I have at the end one table have the customer ID, Transaction and the address. I read about stored functions and procedures but I can't figure away how to apply this on my case. ( I am using phpmyadmin)

Edit (I need this to be dynamically, every time a new row is added to table 2, it looks for the customer ID in table 1 and get its address and write it in table 2)

Aucun commentaire:

Enregistrer un commentaire