mcmuney Posted June 26, 2015 Share Posted June 26, 2015 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. Quote Link to comment https://forums.phpfreaks.com/topic/297052-inserting-data-in-multiple-tables/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.