Good night, i am trying to translate this script into MySQL. In fact, i have made a progress of this little snippet.
Could you please tell me what am i doing wrong?
CREATE TEMPORARY TABLE mydb.VAR001 (
insert into mydb.VAR001
select @row_number:=@row_number+1 AS row_number, trainingId from mydb.tb_trainingHistoryStatus where userId = 77423 and trainingStatusId = 2
group by trainingId;
DECLARE MIN INT default 0;
DECLARE MAX INT default 0;
SET MIN := ( SELECT MIN(id) FROM mydb.VAR001 );
SET MAX := ( SELECT MAX(id) FROM mydb.VAR001 );
WHILE ( @MIN < @MAX ) DO
select * from mydb.VAR001
SET @MIN = @MIN+1
DROP TEMPORARY TABLE mydb.VAR001;
1- The tempoarary table could duplicate on execution time because of threads correct?
2- I get an error on the While statement
3- generally i cannot run from BEGIN to END without problems. I get several errors.
Thank you very much for your advice