![]() |
| |||||||
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
| |||
| There is a many to many between cars and owners for rental purposes so I added the company_car join table. company: companyId company_type [owner, lessee] company_car_join: carID companyID car_owner: carID companyID start_date end_date So I think I need a SQL query or a procedure to update the join table from the car_owner table? This is as far as I got on the stored procedure. If I need a SQL update query I don't know how to write it. CREATE PROCEDURE update_car_comp_jn() Begin for each row in Comp_Car_Owner set car_comp_join.comp_id = car_owner.comp_id set car_comp_join.car_id = car_owner.car_id END I have one question on structure. Is it right I don't need an auto- increment key since I can use the concatenated company_id and the car_id as a unique key? I can drop the column company_id from car_owner table. thanks, |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |