SET @x =0;
SELECT

(@x:=@x+1)
, a
, b
, c

FROM tab
;

———-

Beispiel:
drop table p_music_auf_LP_mit_id ;

set @x =0;
create table p_music_auf_LP_mit_id
SELECT
(@x:=@x +1) AS id
, year
, interpret_lastname
, interpret_prename
, album
FROM p_music_auf_LP
;

Kategorien: SQL