SELECT CONCAT(rtrim(Xyz.FirstName), rtrim(Xyz.LastName)) as person from Xyz
WHERE Person = ('JohnSmith')
以上工作但我的输入参数中有一个空格 例子" John Smith"。我尝试添加
WHERE Person = ltrim('John Smith')
但这也不起作用。
答案 0 :(得分:0)
查询:
SELECT CONCAT(rtrim(Xyz.FirstName), rtrim(Xyz.LastName)) as person from Xyz
WHERE Person = ('Jon Smith')
由于空间而无法返回任何记录,而您rtrim
字段
你可以使用类似的东西:
SELECT CONCAT(rtrim(Xyz.FirstName), concat(' ', rtrim(Xyz.LastName))) as person from Xyz
WHERE Person = ('Jon Smith')
请注意concat
部分中的额外Select
和空格('')。
答案 1 :(得分:-1)
就像这样:
select * from person where trim(last_name)||trim(first_name)= replace('John Smith', ' ', '')