Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. Quick Select Question
      Hi All, I have a column in my table with values like this: CBMON3.03122005 WESAT1.04262006 TRSAT3.01282006 .. .. ..
    2. 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...
    3. 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...
    4. 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...
    5. 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...
  3. #2

    Default 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

  4. #3

    Default Re: SQL Select question

    thanks Phil
    megalith Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139