Welcome to WebmasterWorld Guest from 220.127.116.11
Forum Moderators: open
for each item n in table A,
I want to INSERT a row into table B.
I can get all the ID's I want like this:
SELECT * FROM tableA WHERE id > 500
which might return maybe a few thousand rows.
then for each of those, I want to do this:
INSERT INTO tableB (id,foo,bar) VALUES ( [id_from_previous_select] ,'abc','def')
I can write a PHP script to do it, with a loop. I know.
I'm curious if there's a faster way, a better way, using SQL commands only.