Getting rows which include a value with MySQL

Posted by sundowatch on Stack Overflow See other posts from Stack Overflow or by sundowatch
Published on 2010-05-16T06:23:40Z Indexed on 2010/05/16 7:20 UTC
Read the original article Hit count: 144

Filed under:
|

I have a MySQL query which gets including some vars like that:

messages TABLE receiver cols

  • user1 rows : 1,3,5
  • user2 rows : 2,3
  • user3 rows : 1,4

I want to get rows which includes '3' value. So I will get 'user1' and 'user2'.

I tried that but naturally it doesn't work.

mysql_query("SELECT * FROM messages WHERE receiver='3'");

How can I do this?

© Stack Overflow or respective owner

Related posts about mysql

Related posts about sql