正如标题所示,我想知道如何在in 中设置concat
两个字段。这是我想要实现的一个例子:where clause
mysql
SELECT CONCAT_WS(' ', first_name, last_name) AS name FROM `users`
WHERE name LIKE "%John Doe%"
关键是first_name
和last_name
是单独的字段,我想让我的PHP
应用程序能够搜索完整的人名。
有小费吗?
干杯!
正如标题所示,我想知道如何在in 中设置concat
两个字段。这是我想要实现的一个例子:where clause
mysql
SELECT CONCAT_WS(' ', first_name, last_name) AS name FROM `users`
WHERE name LIKE "%John Doe%"
关键是first_name
和last_name
是单独的字段,我想让我的PHP
应用程序能够搜索完整的人名。
有小费吗?
干杯!
尝试这个 ::
SELECT CONCAT_WS(' ', first_name, last_name) AS name FROM `users`
WHERE CONCAT_WS(' ', first_name, last_name) LIKE "%John Doe%"
pick up the users as view then query outside select query
select name from (select first_name||last_name FROM `users`
WHERE frst_name LIKE "%John%" or last name like "%doe%") where name like '%John Doe%'