作者:心只为你跳国 | 来源:互联网 | 2023-05-18 02:22
IhaveanSQLitedatabase.Iamtryingtoinsertvalues(users_id,lessoninfo_id)intablebookmarks
I have an SQLite database. I am trying to insert values (users_id
, lessoninfo_id
) in table bookmarks
, only if both do not exist before in a row.
我有一个SQLite数据库。我试图在表书签中插入值(users_id,lessoninfo_id),但前提是它们之前不存在。
INSERT INTO bookmarks(users_id,lessoninfo_id)
VALUES(
(SELECT _id FROM Users WHERE User='"+$('#user_lesson').html()+"'),
(SELECT _id FROM lessoninfo
WHERE Lesson="+lesson_no+" AND cast(starttime AS int)="+Math.floor(result_set.rows.item(markerCount-1).starttime)+")
WHERE NOT EXISTS (
SELECT users_id,lessoninfo_id from bookmarks
WHERE users_id=(SELECT _id FROM Users
WHERE User='"+$('#user_lesson').html()+"') AND lessoninfo_id=(
SELECT _id FROM lessoninfo
WHERE Lesson="+lesson_no+")))
This gives an error saying:
这给出了一个错误说:
db error near where syntax.
db error附近的语法。
5 个解决方案