select GROUP_CONCAT(orderNum) as orderNum
from (SELECT CONCAT('(',@rownum := @rownum+1, ')') AS orderNum FROM (SELECT @rownum:=0)r ,
表名 i where i.id='' ) tmptab
结果
SELECT
@rownum := @rownum + 1 AS '排名',
b.type,
b.NAME,
b.description
FROM
tbl_book b,
( SELECT @rownum := 0 ) r
结果:
在原有的列上加前后缀 CONCAT()
SELECT
CONCAT( '你是第: ', @rownum := @rownum + 1, " 名" ) AS '排名',
b.type,
b.NAME,
b.description
FROM
tbl_book b,
( SELECT @rownum := 0 ) r
结果: