> -----Original Message-----
> From: McShen [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 16, 2001 1:56 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Re: enum !!
>
>
> ok. I use set to make a table. here is my table 'test'
> +-------+------+
> | name | cat |
> +-------+------+
> | shen | a,c |
> | shen1 | b,c |
> +-------+------+
>
> How can I find all records that contain 'c'?
> i tried
> select * from test where cat='c';
>
> it returned "empty set";
Quoting from http://www.mysql.com/doc/S/E/SET.html
Normally, you perform a SELECT on a SET column using the
LIKE operator or the FIND_IN_SET() function:
mysql> SELECT * FROM tbl_name WHERE set_col LIKE '%value%';
mysql> SELECT * FROM tbl_name WHERE FIND_IN_SET('value',set_col)>0;
But the following will also work:
mysql> SELECT * FROM tbl_name WHERE set_col = 'val1,val2';
mysql> SELECT * FROM tbl_name WHERE set_col & 1;
The first of these statements looks for an exact match. The
second looks for values containing the first set member.
---
Mark Roedel | "The most overlooked advantage to owning a
Systems Programmer | computer is that if they foul up there's no
LeTourneau University | law against whacking them around a little."
Longview, Texas, USA | -- Owen Porterfield
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]