我有一个SQLite数据库。我试图在表中插入值(users_id
,lessoninfo_id
)bookmarks
,前提是两个值都不连续存在。
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+")))
这给出了一个错误说:
db错误在哪里语法附近。
person (id, name unique)
,cat (person_id, name unique)
我想插入很多对(person_name, cat_name)
吗?