Mailing List Archive



Back to the month index Back to the list index

Jeff Ramacher (jeffr@maui.com)
Thu, 19 Sep 1996 08:56:31 -1000


Date: Thu, 19 Sep 1996 08:56:31 -1000
Message-Id: <199609191856.IAA02447@mrtc.org>
From: jeffr@maui.com (Jeff Ramacher)
Subject: Re: [mSQL] [w3-mSQL] Search for a substring

>
>I am running version 1.0 of w3-msql on an AIX machine...
>I need to find a substring within a string, for example 'Avenue'
>where all the records with an address string containing 'Avenue' will be
>returned.
>

That's easy. Just use the LIKE clause of the SELECT statement.
For example,
  SELECT street FROM mytable WHERE street LIKE '%Avenue%'

To get that without a concern for case-sensitivity, try:
  SELECT street FROM mytable WHERE street LIKE '%[Aa][Vv][Ee][Nn][Uu][Ee]%'

The percent sign matches any number of characters. See the docs for more info.

Now the tricky part is matching 'Avenue' only when it appears as a normal
word, e.g. surrounded by either whitespaces or special characters
!@#$%^&*()-=+, and *not* if it's *part* of another word, e.g.
'Avenuesomethingorother'. Any help is appreciated.

Jeff R.

--------------------------------------------------------------------------
To remove yourself from the Mini SQL mailing list send a message containing
"unsubscribe" to "unsubscribe" to msql-list-request@bunyip.com. Send a message containing
"info msql-list" to majordomo@bunyip.com for info on monthly archives of
the list. For more help, mail owner-msql-list@bunyip.com NOT the msql-list!