我有一个包含两个表的SQLITE数据库。表A有一个整数时间戳和另一个整数列,其中包含一个行id,表示表B中有两个时间戳的行。
我想删除表A中的所有行,其中时间戳不在表B中的两个时间戳之间,并且ROWID等于X.
这是我目前所拥有的,但我收到语法错误:
DELETE FROM network
WHERE ROWID in (
SELECT ROWID
FROM track
INNER JOIN network ON (track.ROWID = network.trackId)
WHERE network.timestamp > track.stopTime OR network.timestamp < track.startTime
AND network.trackId = X
答案 0 :(得分:17)
您的子选择没有右括号。试试这个:
DELETE FROM network
WHERE ROWID in (
SELECT ROWID
FROM track
INNER JOIN network ON (track.ROWID = network.trackId)
WHERE network.timestamp > track.stopTime OR network.timestamp < track.startTime
AND network.trackId = X
)
如果这不起作用,请尝试发布实际的语法错误。