请教MySql同表查询语句
insert into `content` (filename) select max(id)+1 as maxid from `content` 不明白这句,为什么values要去掉?反而不去掉就是错误的?例如,我想insert into `content` (filename) values(select max(id)... 展开
其他答案
使用select查询结果做插入值的时候就是这样的语法规定。如果插入多个字段也是一样的。比如,你还要插入filesize,filedesc,就这样写:insert into `content` (filename,filesize,filedesc) select max(id)+1 as maxid,filesize,filedesc from `content`;
2011-01-16 00:11
来自北京市
赞(0)点赞赞(0)举报
免责声明:问答内容均来源于互联网用户,房天下对其内容不负责任,如有版权或其他问题可以联系房天下进行删除。


