I have two database tables, users and logs. I need SQL code to do something in rows
foreach(id in users)
insert into logs a record with user_id = id;
endforeach;
I could use php to implement foreach, but I decided it was probably a pure SQL way. I am using a MySQL server if this helps.
sjobe source
share