sqldatabaseloopsnexusdb

NexusDB for each loop / substitute


I need a little push up. I have a temporary table created from a select.

Now I need to go through that table and for each record in that table I need to do insert to other table with some values from this temporary tables.

Anyway I can't figure out any way how to do it in NexusDB.

Simply I want to do this in nexusdb sql:

foreach(record in table1){
  insert into table2 (columns) values record.id, record.name ... etc.
}

I hope it does make sense to you guys and I look forward to some beautiful ideas of yours.

Thanks.


Solution

  • NexusDB does not need "foreach", you can do it like this:

    insert into temp1 (field_2, field_3) (SELECT field_2, field_3 FROM temp2)