Jump to content

Inserting data in multiple tables


mcmuney

Recommended Posts

What I'm trying to do involves 3 tables:

 

Table1: id, status

Table2: id, value

Table3: id, value1, value2

 

Step1: Pull all unique id numbers where status=1 from Table1

Step2: For each id pulled in Step1, insert a value=(random number between 1-5; important: the random number should be different for each insert for each id) into Table2

Step3: For each id and value inserted in Step2, update in Table3 where Table3.id=Table2.id  set value1=(existing value +1) and value2=(existing value +the random value inserted in Step2

 

Any guidance would be greatly appreciated. Thanks.

Link to comment
https://forums.phpfreaks.com/topic/297052-inserting-data-in-multiple-tables/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.