字符串列表的更新语句
Update statement for a list of strings
我正在使用 sqlite3
,我的 table 有一个文本字段,实际上有一个字符串列表。
所以样本 select (select * from table where id=1
) 会 return 例如
1|foo@bar.com|21-03-2015|["foo", "bar", "foobar"]
虽然我不知道更新列表的 sqlite 语句是怎样的。我试过了
update table set list="["foo", "bar"] where id=1;
update table set list=["foo", "bar"] where id=1;
update table set list="\["foo", "bar"\]" where id=1;
update table set list=(value) where id=1 VALUES (["foo", "bar"])
这是您需要的声明:
UPDATE table SET list = '[\"foo\", \"bar\"]' WHERE id = 1
我正在使用 sqlite3
,我的 table 有一个文本字段,实际上有一个字符串列表。
所以样本 select (select * from table where id=1
) 会 return 例如
1|foo@bar.com|21-03-2015|["foo", "bar", "foobar"]
虽然我不知道更新列表的 sqlite 语句是怎样的。我试过了
update table set list="["foo", "bar"] where id=1;
update table set list=["foo", "bar"] where id=1;
update table set list="\["foo", "bar"\]" where id=1;
update table set list=(value) where id=1 VALUES (["foo", "bar"])
这是您需要的声明:
UPDATE table SET list = '[\"foo\", \"bar\"]' WHERE id = 1