Beck
Beck

Reputation: 27

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.

Upvotes: 0

Views: 81

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269973

Use like:

where name like '% 1'

Upvotes: 2

Related Questions