Answer the question
In order to leave comments, you need to log in
Inserting a record into one table when there is a record in another table?
Good afternoon.
There is a table tmp_id-data two columns (id-data, time_connect).
The second table is info_table (id-data, data, comment).
What do you need. You need to insert an entry into the first tmp_id-data table only if there is id_data in the info_table table. If there is no date, do not insert anything.
Now I'm doing a check, if there is id-data in table 2, I'm doing an INSERT, but I would like to do it at once.
Answer the question
In order to leave comments, you need to log in
If insert into select is considered "do it once", then something similar to:
INSERT INTO "tmp_id-data"("id-data", "time_connect")
SELECT "id-data", 'здесь необходимый для вставки time_connect'
FROM "info_table"
WHERE "id-data" = 'здесь необходимый для вставки id-data'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question