M
M
MdaUZH2016-01-07 10:31:09
PHP
MdaUZH, 2016-01-07 10:31:09

LIKE sql on 2 fields?

Hello, tell me how to make a search on 2 fields with LIKE?

SELECT * FROM users WHERE email,name LIKE '%checn%'

doesn't work, syntax error..

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Egor Stakhovsky, 2016-01-07
@ySky

email LIKE '%checn%' OR name LIKE '%checn%'
or
CONCAT_WS(' ', email, name) LIKE '%checn%'

D
Dmitry Bay, 2016-01-07
@kawabanga

SELECT * FROM users WHERE email  LIKE '%checn%' and name LIKE '%checn%'

and so?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question