Having trouble with this proc. I come from Microsoft SQL background. The code makes sense to me but I get Syntax errors. Any help appreciated. I am under a time constraint. Here is the code:
BEGIN
SET @source_id := 0;
SET @dest_id := 0;
select @source_id = list_id from mw_list l where list_id > @source_id LIMIT 1;
WHILE @source_id IS NOT NULL
select @dest_id = list_id from mw_list where list_id > @dest_id and list_id <> @source_id LIMIT 1;
WHILE @dest_id IS NOT NULL
IF NOT EXISTS (SELECT * from test_list_subscriber_action WHERE source_list_id = @source_id AND
target_list_id = @dest_id AND source_action = ‘unsubscribe’ AND target_action = ‘unsubscribe’)
THEN
INSERT test_list_subscriber_action @source_id, ‘unsubscribe’, @dest_id, ‘unsubscribe’;
END IF;
select @dest_id = list_id from mw_list where list_id > @dest_id and list_id <> @source_id LIMIT 1;
END WHILE;
select @source_id = list_id from mw_list l where list_id > @source_id LIMIT 1;
END WHILE;
END
http://www.healthfitnesz.com/