Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- declare @support_id bigint --Variable de parcours pour les support_id
- declare @vehicle_id_table table (support_id bigint) --Table pour le parcour des support_id
- declare @delete_vehicle_support_id table (support_id bigint) --Table des delete à faire
- insert into @vehicle_id_table
- select support_id
- from vehicle_support
- group by support_id, vehicle_id
- having count(support_id)>1
- while (select count(*) from @vehicle_id_table) >0
- begin
- set @support_id = (select top 1 support_id from @vehicle_id_table)
- delete from @vehicle_id_table where support_id = @support_id
- insert into @delete_vehicle_support_id select MIN(id) from vehicle_support where support_id=@support_id -- A la place de ce selecte le DELETE SA MAMAN
- end
- select * from @vehicle_id_table
- select * from @delete_vehicle_support_id
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement