2
Hello, I would like to know how to make several Inserts in a table with the result of a SELECT of all id of another table table that are not as foreign key in the first table.
I already have the SELECT query with LEFT JOIN:
SELECT id FROM exemplo ex LEFT JOIN outra out ON ex.id = out.exemplo_id where out.exemplo_id IS NULL
This returns all n Ids from the other table that are not in the first one, what I want is to make kind of a repeat structure that will run Inserts n times.
I wanted to use SELECT for only one table field, but I will try to do Joins to get all fields in the result.
– André Walker
You do not need to use all, I will edit adding this information
– Luiz Santos
Thanks, it worked very well, I didn’t know I could give a SELECT in just one text :).
– André Walker
Give yes, thank you for giving up arrow and mark as right. Needing are ae.
– Luiz Santos