×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: SQL
Posted by: Kirill Lobastov
Added: Jul 3, 2015 1:31 PM
Modified: Mar 27, 2017 1:35 AM
Views: 4
Tags: no tags
  1. BEGIN
  2.                 DECLARE count_video INT;
  3.                 SELECT COUNT(*) INTO count_video FROM videos;
  4.  
  5.                 WHILE count_video > 0 DO
  6.  
  7.                         UPDATE video_images SET video_id = (
  8.                                 SELECT id FROM videos WHERE dir = (
  9.                                         SELECT dir FROM videos WHERE id = count_video
  10.                                 )
  11.                         ) WHERE video_id = (SELECT dir FROM videos WHERE videos.id = count_video );
  12.  
  13.                         SET count_video = count_video-1;
  14.                 END WHILE;
  15.         END