Reputation: 107
I get this exception:
FATAL EXCEPTION: main android.database.sqlite.SQLiteException: near ".": syntax error: , while compiling: UPDATE items SET I.red='1' FROM items I, feeds F WHERE I.feedLink=F.link AND F.category='Genel'
from this statement:
UPDATE items
SET I.red='1'
FROM items I, feeds F
WHERE I.feedLink=F.link AND F.category='Genel'
using SQLite in Android. How can I solve this?
Note: items and feeds are names of my datebase tables.
Upvotes: 1
Views: 196
Reputation: 205
Try this
UPDATE items i SET i.red='1' FROM items i, feeds f WHERE i.feedLink=f.link AND f.category='Genel'
If that does not do it try breaking it into two queries:
SELECT f.link FROM feeds f WHERE f.category='Genel'
And then use the result from that in the following query:
UPDATE items i SET i.red='1' WHERE i.feedLink IN ([f.link(s) in the result from the prev. query])
Upvotes: 2
Reputation: 2483
SQL UPDATE syntax:
UPDATE table_name
SET column1=value, column2=value2,...
WHERE some_column=some_value
To hone in on what I think you're trying to accomplish:
UPDATE items
SET red='1'
WHERE feedLink IN
(SELECT link FROM feeds WHERE category='Genel')
Upvotes: 1