1

我正在创建如下查询

SELECT CONCAT(u.firstName," ",u.lastName) as user

然后稍后在我写的查询中:

WHERE user LIKE '%jay%'

我没有得到任何结果。您不能以这种方式使用连接字段吗?

4

1 回答 1

3
SELECT CONCAT(u.firstName," ",u.lastName) as user ... WHERE user LIKE '%jay%'

不会工作,但是

SELECT CONCAT(u.firstName," ",u.lastName) as user ... HAVING user LIKE '%jay%'

将起作用,就像HAVING对查询结果起作用一样,而WHERE不起作用。

于 2012-09-27T22:59:03.603 回答