loops - Making a Counter in MySQL Queries -
i trying mysql job self, i'm using navicat enterprise , new problem if wanted make specific column alter everytime execute command. example:
insert result () values ( '1-10218', 'first', '1-10220', /* want act variable, changes 1 @ time [incremental] */ 'second' )
could use @num += 1
??? notice i'm not programming anything, security or best practices not in interest, want change value 1 @ time. desired output this:
1-10218 first 1-10220 second 1-10218 first 1-10221 second 1-10218 first 1-10222 second 1-10218 first 1-10223 second 1-10218 first 1-10224 second 1-10218 first 1-10225 second
how inremental values :
select s.*, @i:=@i+1 increnatal table_source s, (select @i:=0) inc
exact insert can provide after showing input.
insert result (columns) select '1-10218', 'first', concat('1-', @i:=@i+1), 'second' table_source s, (select @i:=10219) inc
Comments
Post a Comment