select count(*) as total ,count(*)+1 as total2 from table_name
很明显二楼的错误的。第二个字段total 从那里来?mysql> select (total + 1) as total2 from (select count(*) as total) as t; +--------+ | total2 | +--------+ | 2 | +--------+ 1 row in set (0.03 sec)
LZ给的没有表,只是这个SELECT语句的正确与否。
select count(*) as total ,count(*)+1 as total2 from table_name而且你这句也是不能成功 的
没有给表的话,count(*) 有用吗??这是我的一个测试: mysql> select count(*) as total ,count(*)+1 as total2 from town; +-------+--------+ | total | total2 | +-------+--------+ | 35 | 36 | +-------+--------+ 1 row in set (0.00 sec)
+--------+
| total2 |
+--------+
| 2 |
+--------+
1 row in set (0.03 sec)
select count(*) as total ,count(*)+1 as total2 from table_name而且你这句也是不能成功 的
mysql> select count(*) as total ,count(*)+1 as total2 from town;
+-------+--------+
| total | total2 |
+-------+--------+
| 35 | 36 |
+-------+--------+
1 row in set (0.00 sec)