How to auto fill a column based on another column’s value? MYSQL

Asked

Viewed 99 times

-2

I have a table of users where have the columns: id_usuario, name, id_company among others. And I have another table where I save other information of this user, and I also have the columns name and id_company, is there any way that when adding the id_usuario in the second table it automatically pulls the value of these other columns from the main table? id user is a Foreign key of the main table

  • 1

    Search for JOIN.

  • Your question got confused. In the database itself you want to pull the data? Replicate? .

  • It was precisely the Join that I needed, I am new in the use of databases and did not know the function. Needed a function that returns the data that is related by the foreign key

1 answer

0

Join gets the result I wanted, returning the values related by the foreign key in two different tables

Browser other questions tagged

You are not signed in. Login or sign up in order to post.