Advertisement
psi_mmobile

Untitled

Jul 24th, 2019
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. INSERT INTO gu_vehicle (gui_user_id, vehicle_id)
  2. SELECT distinct guvo.gui_user_id, :new.vehicle_id
  3. FROM gu_vehicle_owner guvo, vo_vehicle_category vovc
  4. WHERE vovc.vo_vehicle_category_id = :new.vo_vehicle_category_id
  5. AND vovc.vehicle_owner_id = guvo.vehicle_owner_id
  6. 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 ) )
  7. 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