I am now attempting to populate a table (Registers) with the correct number of records for each store.
So, store 100 has a value of 10 in Reg_cnt.
I want to create 10 records in Register (100,1 - 100,2 - 100,3) up to the number based on the Reg_cnt field in Stores.
Each store has a different number of registers (well, some are the same, but it CAN be different).
I guess I could auto-populate by the highest number, then delete ones I don’t need, but that seems too manual to me.
The database is HSQLDB. (Sorry!, but that’s the only choice I had at the time!)
The other fields in Registers can be null for now, they will be updated when the registers are setup.
I’ve seen statements using INSERT INTO … FROM, and some on looping for inserts, but nothing that will do the looping (or whatever) for the number of times based on the value of a field.
It could be because I don’t know what exactly to search for. I’m sorry if this is a duplicate.
Thanks!
Meg
My tables are this: