在 iPad 应用程序上的 SQLite 中复制行
我希望将一行从一个相同的表复制到 SQLite 中的另一个表。这是我的查询:
INSERT INTO savedarticles (headline, author, authorid, lead, contents, section, added, updated, dturl, storyid, pubDate, slot)
SELECT (headline, author, authorid, lead, contents, section, added, updated, dturl, storyid, pubDate, slot)
FROM articles
WHERE articles.storyid = '14556068'
这是 SQLite 给我的错误消息。
DB Error: 1 "near ",": syntax error"
我会复制一行错误吗?我更愿意使用 sql 进行 100% 复制,而不是创建对象并执行插入。
谢谢!
I am looking to copy a single row from one identical table to another in SQLite. Here is my query:
INSERT INTO savedarticles (headline, author, authorid, lead, contents, section, added, updated, dturl, storyid, pubDate, slot)
SELECT (headline, author, authorid, lead, contents, section, added, updated, dturl, storyid, pubDate, slot)
FROM articles
WHERE articles.storyid = '14556068'
And here is the error message SQLite is giving me.
DB Error: 1 "near ",": syntax error"
Am I going about copying a row all wrong? I would prefer to do the copy 100% with sql instead of creating an object and doing an insert.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你不需要在 SELECT 上使用括号:
并且你不需要引用 14556068,除非它确实是一个字符串:
SQLite 中的一切都是字符串,所以它不会在意,但好习惯就是好习惯。
You don't need parentheses on the SELECT:
And you don't need to quote the 14556068 unless it really is a string:
Everything is a string in SQLite so it won't care but good habits are good habits.