Re: Please Help with Pattern Matching
At 14:59 -0500 1/29/02, Douglas Brantz wrote: I have a big problem with pattern matching; Why does the first example work like this I need to find everything with MWF in it and I only get the 1 entry? Is there a way I can make this work. It's unclear what you're expecting to happen. From the output of the second query, it looks like only one entry actually has MWF in it. If that's so, why would you expect the first query to return more than one row? Do you mean you want entries that have M *or* W *or* F? mysql select schdays from courses where schdays LIKE %MWF%; +-+ | schdays | +-+ | MWF | +-+ 1 row in set (0.00 sec) mysql select schdays from courses where schdays LIKE %M%; +-+ | schdays | +-+ | MWF | | MW | | MW | | M | | M | +-+ 5 rows in set (0.00 sec) Thanks in advance, Douglas -- Douglas R. Brantz Computer Consultant Fine Applied Arts Appalachian State University Boone, NC 28608 828-262-6549 (office) 828-262-6312 (fax) - 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
RE: Please Help with Pattern Matching
Doug, MySql is doing what it is supposed to... If you specify '%MWF%' it will only select the values with the string literal 'MWF' in it. If you would like to match all the rows that have either M or W or F in it, then use a query like : select schdays from courses where schdays LIKE %M% OR LIKE %W% OR LIKE %F%; This will return every row that has either M or W or F in the schdays field. Gurhan -Original Message- From: Douglas Brantz [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2002 2:59 PM To: [EMAIL PROTECTED] Subject: Please Help with Pattern Matching I have a big problem with pattern matching; Why does the first example work like this I need to find everything with MWF in it and I only get the 1 entry? Is there a way I can make this work. mysql select schdays from courses where schdays LIKE %MWF%; +-+ | schdays | +-+ | MWF | +-+ 1 row in set (0.00 sec) mysql select schdays from courses where schdays LIKE %M%; +-+ | schdays | +-+ | MWF | | MW | | MW | | M | | M | +-+ 5 rows in set (0.00 sec) Thanks in advance, Douglas -- Douglas R. Brantz Computer Consultant Fine Applied Arts Appalachian State University Boone, NC 28608 828-262-6549 (office) 828-262-6312 (fax) - 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
Re: Please Help with Pattern Matching
In the last episode (Jan 29), Douglas Brantz said: I have a big problem with pattern matching; Why does the first example work like this I need to find everything with MWF in it and I only get the 1 entry? Is there a way I can make this work. mysql select schdays from courses where schdays LIKE %MWF%; | MWF | mysql select schdays from courses where schdays LIKE %M%; | MWF | | MW | | MW | | M | | M | I see nothing wrong here. Your first statement says give me all rows with the string MWF in schdays. Your second statement says give me all rows with the string M in schdays. If you want all rows with M, W, or F in schdays, you'll want something like WHERE schdays LIKE %M% OR schdays LIKE %W% OR schdays LIKE %F%. -- Dan Nelson [EMAIL PROTECTED] - 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
RE: Please Help with Pattern Matching
Try this: select schdays from courses where schdays Regexp[MWF]; -Original Message- From: Douglas Brantz [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2002 2:59 PM To: [EMAIL PROTECTED] Subject: Please Help with Pattern Matching I have a big problem with pattern matching; Why does the first example work like this I need to find everything with MWF in it and I only get the 1 entry? Is there a way I can make this work. mysql select schdays from courses where schdays LIKE %MWF%; +-+ | schdays | +-+ | MWF | +-+ 1 row in set (0.00 sec) mysql select schdays from courses where schdays LIKE %M%; +-+ | schdays | +-+ | MWF | | MW | | MW | | M | | M | +-+ 5 rows in set (0.00 sec) Thanks in advance, Douglas -- Douglas R. Brantz Computer Consultant Fine Applied Arts Appalachian State University Boone, NC 28608 828-262-6549 (office) 828-262-6312 (fax) - 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