Re: How to Query by First Part of a VARCHAR?

2007-07-04 Thread gary
the thing to remember is that if you only want strings that start with CAT you'd never want to query with %CAT% because this could match DOG_CATHY. % is a wildcard that matches any number of characters including none. if you want to match a single character you use _ if you actually need to s

Re: How to Query by First Part of a VARCHAR?

2007-07-04 Thread David T. Ashley
On 7/4/07, Dan Nelson <[EMAIL PROTECTED]> wrote: In the last episode (Jul 04), David T. Ashley said: > On 7/4/07, gary <[EMAIL PROTECTED]> wrote: > > SELECT column FROM table WHERE column LIKE "CAT\_%"; > > Would it be reasonable to assume that if "column" is indexed, the > query would execut

Re: How to Query by First Part of a VARCHAR?

2007-07-04 Thread Dan Nelson
In the last episode (Jul 04), David T. Ashley said: > On 7/4/07, gary <[EMAIL PROTECTED]> wrote: > > SELECT column FROM table WHERE column LIKE "CAT\_%"; > > Would it be reasonable to assume that if "column" is indexed, the > query would execute quickly, i.e. I would assume that the indexing >

Re: How to Query by First Part of a VARCHAR?

2007-07-04 Thread David T. Ashley
On 7/4/07, gary <[EMAIL PROTECTED]> wrote: SELECT column FROM table WHERE column LIKE "CAT\_%"; Would it be reasonable to assume that if "column" is indexed, the query would execute quickly, i.e. I would assume that the indexing would facilitate this kind of query?

Re: How to Query by First Part of a VARCHAR?

2007-07-04 Thread gary
SELECT column FROM table WHERE column LIKE "CAT\_%"; -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

How to Query by First Part of a VARCHAR?

2007-07-04 Thread David T. Ashley
If I have a table with rows like this, all varchar: DOG_LUCY DOG_CHARLIE DOG_LASSIE DOG_XRAY CAT_MR_BIGGLESWORTH CAT_SCRATCHER CAT_WHISTLER what is the form of a query that will return the rows where the first part of the string matches? For example, what if I'd like to return the rows that beg