用于字符串连接的 SQLite 更新语法? [英] SQLite Update Syntax for string concatenation?

查看:37
本文介绍了用于字符串连接的 SQLite 更新语法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含这些数据的表格

I have a table with this data

id , name    , description
1  , apple   , ''
2  , orange  , ''

我正在尝试通过以下语句来更新行,因此描述列是苹果的描述"和橙色的描述",但它不起作用.

I am trying to pass the following statement to update the row so the description column is 'desc of apple' and 'desc of orange' but it is not working.

 Update TestTable Set description = 'desc of ' + name 

连接字符串的正确语法是什么?

What is the proper syntax to concatenate strings?

推荐答案

SQLite 的 字符串连接运算符||",而不是+"

SQLite's string concatenation operator is "||", not "+"

UPDATE TestTable SET description = 'desc of ' || name;

这篇关于用于字符串连接的 SQLite 更新语法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆