MySQL:在SELECT语句中将整数递增1

时间:2012-01-15 13:27:53

标签: mysql select

有没有办法在SELECT语句的整数列中添加1?类似的东西:

$result = mysql_query('SELECT (counter + 1) from table...

感谢。

1 个答案:

答案 0 :(得分:1)

SELECT (counter + 1) AS counter FROM table;

请务必指定列别名(AS counter),否则将更难使用mysql_fetch_assoc()