|
-
Dec 11th, 2003, 06:36 AM
#1
Thread Starter
Hyperactive Member
Search Access DB for string value
Hi,
I am making a website which I need to search for a a value,
basically a normal web site search, you know what I mean.
I have one field call 'searchitem' in a table call tbl_Items this is the field I want to store a running list of words to search through.
so the field would contain something like:
book, Lord of the rings, ring, Tolkien etc...
so if some searched for 'Lord of the rings' it would find that record, I would then want to display it, this I can do myself, its just the search I don't know how to implement
thanks,
-
Dec 11th, 2003, 09:56 AM
#2
Passing SQL to the DB along the lines of:
Select *
from tbl_items
where searchitem like '%' + 'Searchword' + '%'
Would match all of the following:
searchword
searchwords
12searchwordsBlah
Hope thats what you needed.
-
Dec 16th, 2003, 06:25 AM
#3
Thread Starter
Hyperactive Member
so this will search through the whole field and match any contained words?
so if I had these records
Name:
fish
bread
ball
type:
food
food
toy
search:
edible, fins, gills, eyes
yeast, edible, wheat, healthy
round, plastic, yellow
and sent this query:
Select Name from tbl_items where searchitem like '%' + 'edible' '%'
it would return:
Fish
Food
right?
-
Dec 16th, 2003, 06:33 AM
#4
Yep, If i understand your records properly
"Select Name from tbl_items where searchitem like '%' + 'edible' + '%'"
would return:
Fish
Bread
-
Dec 16th, 2003, 09:31 AM
#5
Frenzied Member
Wildcard characters are different for MS Access and SQL Server...
MS Access is *
SQL Server is %
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Dec 16th, 2003, 09:47 AM
#6
Cheers Memnoch i wasn't aware of that.
-
Dec 16th, 2003, 12:36 PM
#7
Thread Starter
Hyperactive Member
-
Dec 18th, 2003, 09:46 AM
#8
Thread Starter
Hyperactive Member
that only works if the search data is exectly what is in the field? I want it to be able to match a word from the field?
such as if data iitem had this in it:
fish sea shark waves
and the statement was looking for the word shark if would show that record?
-
Dec 18th, 2003, 09:47 AM
#9
Thread Starter
Hyperactive Member
no matter,
thank you,
I have found a how to get it o works
Thanks again.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|