From a table write the relevant data into another table

HelloI have two tables. When creating a meal date, you can use the ls_order_lunch field in the table name: lunch_setup to filter out people who have not eaten, and write the values ​​of fields 2-6 into the table name: Lunch table 3-7 fields.The first table name is: lunch_setup
Purpose: Mainly to record information about employee ordering meals.

  1. Serial number (ls_id)
  2. Employee number (ls_id)
  3. Whether to order (ls_order_lunch)
  4. Meat or Vegetarian (ls_mav)
  5. Quantity of soup (ls_soup)
  6. Bento placement position (ls_position)

Another table named: lunch
Purpose: Mainly to record which day there is a meal.
field is

  1. Serial number (l_no)
  2. Subscriber (ls_id) ※ lunch_setup corresponds to employee number (ls_id).
  3. Order date (l_order_date)
  4. Meat or vegetarian (l_mav) ※ lunch_setup echoes meat or vegetarian (ls_mav).
  5. Soup quantity (l_soup) ※ lunch_setup corresponds to soup quantity (ls_soup).
  6. Lunch quantity (l_quantity) ※ lunch_setup echoes whether to order meal (ls_order_lunch).
  7. Lunch placement position (l_position) ※ lunch_setup corresponds to lunch placement position (ls_position).

The final result will be to add records in batches through meal dates, and write the list of people who have meals into the Lunch table.Thanks for help.Ancen

ancenhung wrote:

When creating a meal date…

You may use Row_Inserted to query the first table and then execute INSERT statements to the other table.Also read Database Abstraction Layer.