Alexander
Alexander

Reputation: 153

MySQL Select where number IN column

I need something like this:

SELECT * FROM `table` WHERE '123' IN (`column`)

In 'column' (varchar 255 field) there are some numbers like 1, 50, 145, 123, 58,

I don't know to explain better, but I think you understand what I need.

Upvotes: 0

Views: 1120

Answers (4)

ndasusers
ndasusers

Reputation: 747

SELECT * FROM table WHERE column LIKE '%123%';

Upvotes: 1

alwaysLearn
alwaysLearn

Reputation: 6950

try find_in_set

SELECT * FROM table WHERE find_in_set('123',column)

Upvotes: 1

karmafunk
karmafunk

Reputation: 1453

SELECT * FROM table WHERE FIND_IN_SET('123', column);

See http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_find-in-set

Upvotes: 5

Mark
Mark

Reputation: 8431

try this:

SELECT * FROM table WHERE column IN ('123');

Upvotes: 0

Related Questions