【问题标题】:SQL Column concatenation in Where Clause with Like带有 Like 的 Where 子句中的 SQL 列连接
【发布时间】:2014-09-20 17:30:01
【问题描述】:

问题

我有用户表由列名和姓组成。我的搜索输入可能有 firstname+lastname 。它可以组合搜索

我试过了

SELECT 
last_name, 
first_name,
from 
user
WHERE
last_name+first_name LIKE "%MY input%" 

但它不起作用。如何解决?

【问题讨论】:

  • last_name + ' ' + first_name LIKE "%MY input%"
  • 谢谢我解决了

标签: sql sql-server-2008 concat


【解决方案1】:

试试这个:

SELECT last_name,first_name
from   user
WHERE  contact (last_name,'',first_name) LIKE "%MY input%"; 

【讨论】:

  • Concat 是在 SQL Server 2012 中引入的吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-01-07
  • 2018-07-24
  • 2018-03-08
  • 1970-01-01
相关资源
最近更新 更多