简体   繁体   中英

How to use Concat in a where clause in MYSQL?

I am trying to collect all the names with an extension at the end of a string in MYSQL.

Table1

ID  | Name 
 0    Bob 1
 1    Bob 2
 2    Joe 1
 3    Joe 2
 4    Bob
 5    Joe

The query I'm running is similar to this one:

SELECT ID, name
FROM Fname
WHERE name = CONCAT(name,' ','1');`

Where I want to collect all the Names that end it a space and 1.

使用方式like

where name like '% 1'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM