Reputation: 25928
Why does the following SQLite3 query fail with the error:
SQL Exception: near "||": syntax error
My Query:
UPDATE test
SET money_links||='http://www.test.com', u_links||='http://www.test.com'
WHERE u_tag='test2';
The structure of the table test is:
CREATE TABLE IF NOT EXISTS test(u_tag TEXT PRIMARY KEY, money_links TEXT, u_links TEXT);
Upvotes: 0
Views: 271
Reputation: 70529
UPDATE test
SET money_links = money_links + 'http://www.test.com', u_links = u_links+ 'http://www.test.com'
WHERE u_tag='test2';
UPDATE test
SET money_links = ISNULL(money_links,'') + 'http://www.test.com', u_links = ISNULL(u_links,'') + 'http://www.test.com'
WHERE u_tag='test2';
Upvotes: 2
Reputation: 213005
Do you want to do something like this?
UPDATE test
SET money_links = money_links || 'http://www.test.com',
u_links = u_links || 'http://www.test.com'
WHERE u_tag='test2';
I am afraid SQL does not allow such "incremental concatenation" like some real programming languages.
Upvotes: 1