SQLite TRIM 相同的字符,多列
SQLite TRIM same character, multiple columns
我在 SQLite 数据库中有一个 table,它有多个以“=”开头的列。我知道我可以使用...
SELECT TRIM(`column1`, '=') FROM table;
要清理一列,但是如果我尝试这个,我会收到语法错误...
SELECT TRIM(`column1`, `column2`, `column3`, '=') FROM table;
由于参数数量不正确。
有没有比像这样将 trim 分别应用于每一列更有效的编写代码的方法?
SELECT TRIM(`column1`,'=')as `col1`, TRIM(`column2`,'=')as `col2`, TRIM(`column3`,'=')as `col3` FROM table;
SQLite 指南如何讲述:
trim(X,Y)
The trim(X,Y) function returns a string formed by removing any and all
characters that appear in Y from both ends of X. If the Y argument is
omitted, trim(X) removes spaces from both ends of X.
您只有两个参数,因此不可能一次性在 3 列上应用它 table。
第一个参数是一个列,或者你可以应用的变量trim。第二个参数是要改变的字符。
我在 SQLite 数据库中有一个 table,它有多个以“=”开头的列。我知道我可以使用...
SELECT TRIM(`column1`, '=') FROM table;
要清理一列,但是如果我尝试这个,我会收到语法错误...
SELECT TRIM(`column1`, `column2`, `column3`, '=') FROM table;
由于参数数量不正确。
有没有比像这样将 trim 分别应用于每一列更有效的编写代码的方法?
SELECT TRIM(`column1`,'=')as `col1`, TRIM(`column2`,'=')as `col2`, TRIM(`column3`,'=')as `col3` FROM table;
SQLite 指南如何讲述:
trim(X,Y)
The trim(X,Y) function returns a string formed by removing any and all characters that appear in Y from both ends of X. If the Y argument is omitted, trim(X) removes spaces from both ends of X.
您只有两个参数,因此不可能一次性在 3 列上应用它 table。
第一个参数是一个列,或者你可以应用的变量trim。第二个参数是要改变的字符。