Answer the question
In order to leave comments, you need to log in
How to dynamically copy a value from one table to another with checking for MySQL row repetitions?
I have a webfrom table with id name value rows in it, each id has its own value in name value
For example id 1 , name country (value Russia), name city (value Moscow)
I created a table named it addresses in it rows id , address, coords
How can I copy the values from the webfrom table so that the id value is transferred to the addresses table in the id row, and from city and country to the address row of the addresses table in the format Russia, Moscow?
At the same time, this query will be executed once a day and check if the same value already exists in the webfrom table that is already in the addresses table, for example, Russia, Moscow has already entered the addresses table, if such a value appears again in the webfrom table, then its needs to be excluded to be added to the addresses table.
In the future, the coordinates that I will receive using GeoCoder will be written to the coords line.
Tell me in which direction to dig at all? At least the simplest example.
Answer the question
In order to leave comments, you need to log in
You need to use INSERT...SELECT in conjunction with ON DUPLICATE KEY IGNORE.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question