Neil,
Thank you for giving me that idea. That exact syntax did not
work with "=" but using "like" worked well. Problem solved.
Thanks,
John
mysql> select availability FROM application;
+---+
| availability |
+---+
| weekdays,weekends,mornings,afternoons,evenings,overnights |
| weekdays,weekends,mornings,afternoons,evenings,overnights |
| weekdays,weekends,mornings,afternoons,evenings,overnights |
| weekdays,weekends,mornings,afternoons,evenings,overnights |
| weekdays,weekends,mornings,afternoons,evenings,overnights |
| weekdays,weekends,mornings,afternoons,evenings,overnights |
| weekdays,weekends,mornings,afternoons,evenings,overnights |
| weekends,mornings |
| weekends,mornings |
| weekdays,weekends,mornings,afternoons,evenings,overnights |
| weekdays,weekends,mornings,afternoons,evenings,overnights |
| weekdays,weekends,mornings,afternoons,evenings,overnights |
| weekdays,weekends,mornings,afternoons,evenings,overnights |
| weekdays,weekends,mornings,afternoons,evenings,overnights |
+---+
14 rows in set (0.00 sec)
mysql>
mysql> select availability from application where availability =
'%afternoons%';
Empty set (0.00 sec)
mysql>
mysql> select availability from application where availability like
'%afternoons%';
+---+
| availability |
+---+
| weekdays,weekends,mornings,afternoons,evenings,overnights |
| weekdays,weekends,mornings,afternoons,evenings,overnights |
| weekdays,weekends,mornings,afternoons,evenings,overnights |
| weekdays,weekends,mornings,afternoons,evenings,overnights |
| weekdays,weekends,mornings,afternoons,evenings,overnights |
| weekdays,weekends,mornings,afternoons,evenings,overnights |
| weekdays,weekends,mornings,afternoons,evenings,overnights |
| weekdays,weekends,mornings,afternoons,evenings,overnights |
| weekdays,weekends,mornings,afternoons,evenings,overnights |
| weekdays,weekends,mornings,afternoons,evenings,overnights |
| weekdays,weekends,mornings,afternoons,evenings,overnights |
| weekdays,weekends,mornings,afternoons,evenings,overnights |
+---+
12 rows in set (0.00 sec)
mysql>
On Fri, 22 Feb 2002, Neil Silvester wrote:
> What about using wildcards?
>
> mysql> select * from application where availability = '%mornings%';
>
> Crude, but it should work.
> Neil
>
>
>
> -Original Message-
> From: John Fulton [mailto:[EMAIL PROTECTED]]
> Sent: Friday, 22 February 2002 7:49 AM
> To: [EMAIL PROTECTED]
> Subject: Selecting set members
>
>
>
> If I have a table with a set such as this:
>
> CREATE TABLE application (
> application_num int(6) NOT NULL auto_increment,
> availability set('weekdays','weekends','mornings','afternoons')
> default NULL, PRIMARY KEY (application_num)
> ) TYPE=MyISAM;
>
> is it possible to search based on members of the set?
>
> For example, someone might have selected ('weekends,mornings')
> for their entry in this set, and I am interested in searching
> for people who are available in the morning. However running a
> query such as:
>
> mysql> select * from application where availability = 'mornings';
>
> would not return a person who is available for both weekends and
> mornings, since there set entry would be 'weekends,mornings'.
>
> Writing querys to try to cover all the posibilities such as:
>
> mysql> select * from application where availability = 'mornings' or
> availability = 'weekends,mornings' or ... ;
>
> Seems like the wrong thing to do. Anyone have any ideas? I wouldn't
> be using sets if I could, but I am stuck with them for this prjoect.
>
> Thanks a lot,
>
> John
>
>
>
> -
> Before posting, please check:
>http://www.mysql.com/manual.php (the manual)
>http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
> <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
-
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php