Ask a Question related to Coldfusion Database Access, Design and Development.
-
megalith #1
SQL Select question
I'm trying to figure out how to get my search results more specific and am
having trouble figuring this out. With the example code below if a user
searches for "hawk" they will get '0' results even though "hawk" is in a comma
delimited list in the "keywords" column of the DB (Access). If I use the
"LIKE" operator on the Keywords column then "hawk" will come up in the results
but will also include "hawkweed" which I don't want.
Is there another way I can write this so that a search for "hawk" will find
the exact match in the comma delimited list of keywords?
Thanks in advance.
<cfquery name="GetResults" datasource="#Datasource#">
SELECT *
FROM Images
WHERE (ImageName LIKE '%#SearchString#%'
OR Category LIKE '%#SearchString#%'
OR ImageComments IN ('#SearchString#')
OR ImageKeywords IN ('#SearchString#'))
ORDER BY SortOrder
</cfquery>
ImageKeywords List
Saw-whet owl, saw whet owl, northern bird, owl perched in tree, Aegolius
acadicus, carnivore, raptor, bird of prey, noctural, predator, wildlife at
night, life, owl rotating head, owl turning head
megalith Guest
-
Quick Select Question
Hi All, I have a column in my table with values like this: CBMON3.03122005 WESAT1.04262006 TRSAT3.01282006 .. .. .. -
Question on a select
Hi all, This is my first post here so please let me know if I miss any list guidelines. :) I was hoping to get some help, advice or pointers... -
Select question
I have the following simple Select statement which produces an error when I attempt to save it as part of a stored proc. Select... -
a question of select()-ion
Hi, I have a select() like so: fd_set sockets; FD_SET(fd, &sockets); .... /* and some more sockets are also set */ /* want to see which... -
select top question
Hi, Here's what I'm trying to do : select * from tableA + select * from tableB where tableB.field1 = tableA.field1 + select top1 from... -
philh #2
Re: SQL Select question
"hawk" is in a comma delimited list in the "keywords" column of the DB
(Access).
There's your root problem.
The "correct" solution to this problem is to properly relate records to
keywords in a many-to-many construction. This requires re-designing the
database.
Good luck.
philh Guest
-



Reply With Quote

