Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- INSERT INTO gu_vehicle (gui_user_id, vehicle_id)
- SELECT distinct guvo.gui_user_id, :new.vehicle_id
- FROM gu_vehicle_owner guvo, vo_vehicle_category vovc
- WHERE vovc.vo_vehicle_category_id = :new.vo_vehicle_category_id
- AND vovc.vehicle_owner_id = guvo.vehicle_owner_id
- AND ( (guvo.vo_vehicle_category_id is null AND guvo.vo_person_category_id is null AND guvo.vo_group_id is null) OR (guvo.vo_vehicle_category_id = vovc.vo_vehicle_category_id ) )
- AND not exists (select vehicle_id from gu_vehicle where gu_vehicle.gui_user_id=guvo.gui_user_id and vehicle_id=:new.vehicle_id);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement