mysql 查询语法有问题吗?尝试从 INNER JOIN 中插入
下面的代码给了我一个模糊且无用的错误:
INSERT INTO database VALUES * FROM dbtemp WHERE dbtemp.number NOT IN (SELECT dbtemp.number FROM dbtemp INNER JOIN database ON dbtemp.number = database.number AND dbtemp.price = database.price);
我已经成功地在这些数据库上运行了其他查询,所以我知道这只是这个语句的语法问题。但就我的一生而言,我看不出有什么问题。任何建议/意见将不胜感激。
谢谢!
The following code is giving me a vague and unhelpful error:
INSERT INTO database VALUES * FROM dbtemp WHERE dbtemp.number NOT IN (SELECT dbtemp.number FROM dbtemp INNER JOIN database ON dbtemp.number = database.number AND dbtemp.price = database.price);
I've successfully run other queries on these databases, so I know its just a problem with the syntax of this statement. But for the life of me I can't see what's wrong. Any suggestions/advice would be greatly appreciated.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这应该是一个 INSERT INTO SELECT 语句吗?您的
INSERT INTO database VALUES *
语法值得怀疑...在执行这样的
INSERT SELECT
操作时,建议使用显式列名称,而不是SELECT *
,以确保它们以正确的顺序返回:Should this have been an
INSERT INTO SELECT
statement? Your syntax ofINSERT INTO database VALUES *
is suspect...When doing an
INSERT SELECT
like this, it is advisable to use explicit column names, rather thanSELECT *
, to be sure they are returned in the correct order: