Reputation: 2642
I have a SQLITE database with two tables. Table A has an integer timestamp and another integer column containing a row id referring to a row in table B which has two timestamps.
I want to delete all rows in table A where it's timestamp does not lie between the two timestamps in table B, and the ROWID is equal to X.
Here is what I have at the moment but I am getting a syntax error:
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
Upvotes: 15
Views: 14595
Reputation: 79556
You don't have a closing parenthesis for your subselect. Try this:
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
)
If that doesn't work, try posting your actual syntax error.
Upvotes: 17