给mysql表和视图增加行号

给mysql表和视图增加行号

(1)通过传参方式

set @num := 0;
select (@num := @num+1) as num, `編碼`,`編碼名稱`,`狀態`,`申請時間` from view_users;

(2)纯SQL方式,superset只支持写SQL

SELECT
       (@row_number := @row_number + 1) AS 序号,
       申請時間
FROM view_users,
(
    SELECT @row_number := 0
) AS t
ORDER BY 申請時間;

你可能感兴趣的:(mysql,superset,mysql,superset)