字段分行加一 sql语句

例如:帖子的楼数

insert into forumposts(themes_id,user_id_posts,posts_content,posts_icon,disable_time,floor_number) values(1,106,'aaa','2.png',1235444,(select max(a.floor_number) from forumposts a where themes_id = 1)+1);

如果不加别名的话,报错:You can't specify target table 'forumposts' for update in FROM clause

posted @ 2012-06-20 14:15  lcuzhanglei  阅读(191)  评论(0编辑  收藏  举报