Sipan
Sipan

Reputation: 221

How can i get rows from database

In my database there are fields where values like this:

14,20,12,13,1,22,28,23,5,3,30,15

I want to take that have a value 20.

I tried to do like this:

SELECT * FROM USER WHERE 20 IN (expertise)

so but returns those lines which begin with 20

Upvotes: 2

Views: 43

Answers (2)

Sipan
Sipan

Reputation: 221

SELECT * FROM USER WHERE FIND_IN_SET(20,lawyer_expertise);

Upvotes: 1

Man Programmer
Man Programmer

Reputation: 5356

SELECT * FROM USER WHERE expertise=20

OR

SELECT * FROM USER WHERE expertise IN (20)

OR If you have comma seperated values

 SELECT * FROM USER WHERE expertise like "%20%"

Upvotes: 1

Related Questions