Ian*_*ink 134 sql sqlite string concatenation operators
我正在尝试执行SQlite替换功能,但在函数中使用另一个字段.
select locationname + '<p>' from location;
Run Code Online (Sandbox Code Playgroud)
在此剪辑中,结果是0的列表.我希望有一个字符串,其中包含来自locationname和'<p>'
文字的文本.
cod*_*ict 263
尝试使用||
代替+
select locationname || '<p>' from location;
Run Code Online (Sandbox Code Playgroud)
从SQLite文档:
|| operator是"concatenate" - 它将两个操作数字符串连接在一起.
sha*_*mar 38
该||
操作是在SQLite的级联.使用此代码:
select locationname || '<p>' from location;
Run Code Online (Sandbox Code Playgroud)
Bri*_*rns 31
为了比较,
SQLite || Oracle CONCAT(string1, string2) or || MySQL CONCAT(string1, string2, string3...) or || if PIPES_AS_CONCAT enabled Postgres CONCAT(string1, string2, string3...) or || Microsoft SQL Server 2012+ CONCAT(string1, string2, string3...) or + Microsoft Access +