[thelist] SQL: Searching a field with mutiple names

Jon Haworth jhaworth at witanjardine.co.uk
Thu Aug 2 09:40:06 CDT 2001


Not wishing to tread on rudy's toes here, but...

Can we see the full query? (and which database are you using?) With MySQL,
our intranet search finds things fine with this query:

SELECT * FROM SystemPages WHERE PageContent LIKE '%wombat%' OR PageContent
LIKE '%toothpaste%' OR PageContent LIKE '%aubergine%'

(obviously this is a fairly common search string :-)


Cheers
Jon


-----Original Message-----
From: Toivonen, Nicole [mailto:Nicole.Toivonen at crt.xerox.com]
Sent: 02 August 2001 15:18
To: thelist at lists.evolt.org
Subject: [thelist] SQL: Searching a field with mutiple names


She of the annoying SQL questions returns:

I'm trying to implement a database search, and am finding that I'm not able
to come up with any records.

The databse is an authors database, and the search is mainly based on the
user entering the name, or partial name in a text field.  Simple, yes?
Not so much, for me anyway.  The field being searched contains several
names, most of the time, since those wacky scientists tend to write papers
together.  So, a given record could look like:

Toivonen, N; Loutfy, R; Smith, P

How do I then pull the 'Toivonen' records from the DB?  I'm sure I'm missing
something.

LIKE '%Toivonen%'
LIKE 'Toivonen%'
and
LIKE 'Toivonen'

aren't working for me.




More information about the thelist mailing list