SELECT
t.A,
t.B,
t.C,
ROW_NUMBER() OVER (ORDER BY (SELECT 1)) AS number
FROM tableZ AS t
Lihat contoh kerja di SQLFiddle
Tentu saja, Anda mungkin ingin menentukan urutan penomoran baris – jika demikian, cukup tukar OVER (ORDER BY (SELECT 1))
untuk, misalnya, OVER (ORDER BY t.C)
, seperti dalam ORDER BY
biasa klausa.