troubleshooting Question

While loop with variable in MYSQL?

Avatar of advlegals
advlegals asked on
MySQL Server
3 Comments1 Solution2237 ViewsLast Modified:
How do I iterate through every record of one table to create record in another table?

I want to run an insert  statement for every user in the users table.  The new data will be inserted into the PERMISSIONS table.  

DO WHILE EVERY USER IN USER TABLE

INSERT into permissions SET permission_user = *user ID from users table*, SET permission_grant_on = "team", SET permission_item = -1, SET permission_value = -1
ASKER CERTIFIED SOLUTION
Aleksandar Bradarić
Software Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros