Re: Compare a given value with multiple values field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If you have the literal string "3,31,11,10" in a field in your table then you can 'search' for numbers in the string like this:

SELECT * FROM table WHERE CONCAT(',', tablefield1, ',') LIKE '%,3,%'

I don't know if it's the best way of doing it but it works for me.

Natalie Leotta wrote:
I'm not sure I understand your question, but my interpretation would be
solved like this

select * from table where variable in (select id from tablefield1)

I hope this helps you!!

Natalie

On 9/16/06, Hassan <aldoyh@xxxxxxxxx> wrote:

Hi My Best List, I have a field in a table contains "3,31,11,10" (let say
tablefield1) and I have a given value which I need to check if it exists in
that list.

  I've tried:
  SELECT * FROM table WHERE 3 IN ( tablefield1 );

  Any ideas?


---------------------------------
Get your email and more, right on the  new Yahoo.com



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux