Welcome Guest, Not a member yet? Register   Sign In
MySQL: Inserting data based on insert_id, in a single query?
#6

[eluser]mddd[/eluser]
@resolv_25:
Thanks. I know how 'insert_id' works. The trouble is, I am doing large imports on a regular basis. This puts a strain on the database. So I am optimizing the number of calls I have to do. That is why I was looking to combine as many queries as I can.

@mattpointblank:
Thanks. Combining inserts does limit the number of queries and that is a very good thing.

@all:
I haven't been able to find a way to insert data into two tables from a single query while. Finally, I made a system to generate a unique id for every record in advance, and use that id in both tables. Eliminating the need to know the insert_id from the database at all. This (not checking the id), combined with putting 10 or 20 rows in each insert made the whole import about 20 times faster.


Messages In This Thread
MySQL: Inserting data based on insert_id, in a single query? - by El Forum - 05-06-2010, 12:16 AM



Theme © iAndrew 2016 - Forum software by © MyBB