Insert multiple rows from another table

I have three tables: Customers, Tasks and customers_tasks. The third table provides the relationship, so a customer can have multiple pre-defined tasks associated with it.

Consider the following:

Customers:
cust_1
cust_2

Tasks:
task_1
task_2

Now, when I create add record cust_3 to the Customer table, I also want to insert into the customer_tasks table a row for each of the tasks, eg:

customer_tasks:
Customer,Task
cust_3,task_1
cust_3,task_2

Is this possible?

0 3 71
3 REPLIES 3


@andrewh wrote:

Is this possible?


 

Yep. Search for "add any number of rows" and/or "loop" in this community.

Sorry, I'm not finding anything particularly appropriate. Please could you point me in the right direction?

Top Labels in this Space