#1064 - You have an error in your SQL syntax

   日期:2025-12-29 09:26:40        我要评论    
核心提示:这样写语法不对吧, values后面每一行不能简单用逗号连, 应该这样写insert into 'pre_common_district' (`id`, `name`, `
这样写语法不对吧, values后面每一行不能简单用逗号连, 应该这样写
insert into 'pre_common_district' (`id`, `name`, `level`, `usetype`, `upid`, `displayorder`)
select 12599, '河东街道', 4, 0, 1695, 0 union
select 12600, '玉泉镇', 4, 0, 1695, 0 union
........

或者你为每一行写一个insert into语句也行,如:
insert into 'pre_common_district' (`id`, `name`, `level`, `usetype`, `upid`, `displayorder`)
values (12599,'河东街道', 4, 0, 1695, 0)

insert into 'pre_common_district' (`id`, `name`, `level`, `usetype`, `upid`, `displayorder`)
values (12600, '玉泉镇', 4, 0, 1695, 0)

......追问
不行的,按第一种方法出现:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'union), (12600, '玉泉é', 4, 0, 1695, 0 union), (12601, '红星乡', 4, 0, 16' at line 1
追答
table 和 字段名应该不用加引号,  
insert into pre_common_district (id, name, level, usetype, upid, displayorder)
select 12599, "河东街道", 4, 0, 1695, 0 union
select 12600, "玉泉镇", 4, 0, 1695, 0 union
........
 
标签: error syntax SQL
 
更多>同类茂名资讯
0网友留言、评论、咨询

网站资讯免责声明:
网站资讯所提供的信息及资料除原创外,有部分资讯从网络等媒体收集而来,版权归原作者及媒体网站所有,网站资讯力求保存原有的版权信息并尽可能注明来源;部分因为操作上的原因可能已将原有信息丢失,敬请原作者谅解,如果您对网站资讯所载文章及作品版权的归属存有异议,请立即通知本站客服邮箱404493025@qq.com,将给予处理删除,同时向您表示歉意!

最新茂名资讯
推荐茂名资讯
点击排行
申请链接  |  更多>
友情链接
网站首页  |  关于我们  |  联系方式  |  使用协议  |  版权隐私  |  网站地图  |  会员登录  |  免费注册会员  |  免费发布信息  |  京ICP备09096088号-18