List:General Discussion« Previous MessageNext Message »
From:David T. Ashley Date:July 4 2007 6:42pm
Subject:How to Query by First Part of a VARCHAR?
View as plain text  
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 begin with "CAT_",
which should give 3 rows?

Thanks.

P.S.--This example is contrived to illustrate what I'm trying to achieve.
My actual application is different.  A database of cats and dogs would
naturally be best structured differently.  Thanks.

Thread
How to Query by First Part of a VARCHAR?David T. Ashley4 Jul
  • Re: How to Query by First Part of a VARCHAR?gary4 Jul
    • Re: How to Query by First Part of a VARCHAR?David T. Ashley4 Jul
      • Re: How to Query by First Part of a VARCHAR?Dan Nelson4 Jul
        • Re: How to Query by First Part of a VARCHAR?David T. Ashley4 Jul
          • Re: How to Query by First Part of a VARCHAR?gary4 Jul