Use cursor to update a MySQL table, based on a search

0

I would like some guidance on a challenge in MySQL 8. I have two tables:

usuarios (id_user, nome, nascimento, endereço, cidade, ...)

utilizacao (id_medicamento, nome, nascimento, medicamento, data, ...)

The usuarios table stores all user data, each with a id .

The utilizacao table stores all users' uses (and contains many more rows), but I do not have id_user to make a Join , only the name and date of birth, which are fields also found in table usuarios .

I need to create a Cursor that runs line by line to the utilizacao table, looking for the corresponding id_user , comparing the name and birth with the usuarios table, and updating that id_user in the utilizacao table, in a new column.

    
asked by anonymous 24.08.2018 / 15:20

0 answers