Heim >Backend-Entwicklung >PHP-Tutorial >为什么插入不了
-- -- Table structure for table `category`-- CREATE TABLE IF NOT EXISTS `category` (`id` int(11) NOT NULL AUTO_INCREMENT,`catpath` varchar(255) DEFAULT NULL,`name` varchar(255) DEFAULT NULL,PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=11 ;-- -- Dumping data for table `category`-- INSERT INTO `category` (`id`, `catpath`, `name`) VALUES(1, '0', '网站首页'),(2, '0-1', 'Linux OS'),(3, '0-1', 'Apache服务器'),(4, '0-1', 'MySQL数据库'),(5, '0-1', 'PHP脚本语言'),(6, '0-1-2', 'Linux 系统教程'),(7, '0-1-2', 'Linux 网络技术'),(8, '0-1-2', 'Linux 安全基础'),(9, '0-1-2-7', 'Linux LAMP'),(10, '0-1-3-10', 'apache Server');
INSERT INTO `category` (`id`, (select concat(catpath,'-',id) as abspath from category order by abspath) as abspath, `name`) VALUES(44, '0-1-2-11', '网站首页');为什么不能插入
INSERT INTO `category` (`id`, `abspath`, `name`) VALUES
INSERT INTO `category` (`id`, `abspath`, `name`) VALUES
INSERT INTO `category` (`id`, `abspath`, `name`) VALUES
INSERT INTO `category` (`id`, `catpath`, `name`) VALUES
(44, (select concat(catpath,'-',id) as abspath from category order by abspath) as abspath, '网站首页');
???
不知道想干什么,你的category表里并没有abspath字段。
是否写错,是这个字段catpath呢?