List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:July 15 2001 2:14am
Subject:Re: Newbie Questions
View as plain text  
At 6:39 PM -0700 7/14/01, Bob Rea wrote:
>OK, mr newbie here. I'm trying to lern SQL using MySQL. I have a
>general SQL book, Sams Teach Yourself  SQL in 10 Minutes, by Ben
>Forta. I also have mSQL and MySQL fromO'Reilly. And of course i have
>the MySQL Manual.
>
>The 10 minute book's syntax sometimes doesn't fit MySQL's, so I try
>to find the MySQL way by trial and error, or ny the O'Reilly book.
>Some times this works and sometines I fail. For instance, the 10 min
>book has a query:
>
>SELECT cust_contact
>FROM Customers
>WHERE cust_contact LIKE '[JM]%'
>ORDER BY cust_contact;
>
>The reply is:
>Empty set (0.02 sec)
>
>So I need to know the correct syntax for this query, such that it
>returns only cust_contacts which begin with J or M.
>
>I have searched the Manual and so on.
>
>Point me in the right direction or something.

This is what you want:

WHERE cust_contact REGEXP '^[JM]'

>
>--
>Bob Rea
>
>	Fear of Hell is pernicious;
>                 So is fear of Heaven.
>
>rear@stripped   http://www.sirius.com/~rear



-- 
Paul DuBois, paul@stripped
Thread
Newbie QuestionsBob Rea15 Jul
  • Re: Newbie QuestionsHank Marquardt15 Jul
    • Re: Newbie QuestionsGrigory Bakunov15 Jul
  • Re: Newbie QuestionsPaul DuBois15 Jul