Querying multiple fields

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

  1. #1

    Default Querying multiple fields

    I want to create a query where data in one form field matches any of six other
    fields the record is selected. Anyone have an example of how to write this?
    Seems simple enough but nothing I'm doing works. I'm querying SQL.

    cfif form.data EQ database.field1 or database.field2 or etc



    Nat5 Guest

  2. Similar Questions and Discussions

    1. Changing the Value on multiple fields
      Hi Folks, I have a database that, among other things, has a field called 'pos' - short for position. The idea is that via a form, I can change...
    2. multiple text fields
      As frame5 is entered, multiple text fields are supposed to be created. I have 3 createTextFields. Each one works, if it's the only one I didin't...
    3. Search multiple keywords across multiple fields
      Hi, I'm about halfway through building a search engine using ASP, SQL and Access. As part of that search engine I need to search multiple...
    4. Fill in multiple fields with AfterUpdate
      Emilia, Sorry for the late response. My motherboard failed on me. The troubleshooting process took a greater portion of last week. Hardware...
    5. SQL Search Multiple Fields ??
      James wrote: Yes. Well, just execute this SQL statement using the PHP extension for the SQL server you're using. By the way: how does...
  3. #2

    Default Re: Querying multiple fields

    can you post some code.

    jorgepino Guest

  4. #3

    Default Re: Querying multiple fields

    I don't see a WHERE clause in your SELECT. Also, since you are joining two
    tables, you are going to get a Cartesian join (number of rows equaling the
    product of both tables) unless you relate the two tables to one another, either
    in a JOIN or WHERE clause.

    Phil

    paross1 Guest

  5. #4

    Default Re: Querying multiple fields

    where is the WHERE?
    jorgepino Guest

  6. #5

    Default Re: Querying multiple fields

    Thanks. I redid the some of it and left that out by accident.

    I'm really trying to figure out this part:
    <cfif isDefined("Form.certarea")>
    AND appCert.cert1Area EQ '#form.certarea#'
    </cfif>

    I need form.certarea to not only match up with appCert.cert1 but also cert2,
    cert3, cert4, cert5 and cert6 fields. I tried to use an OR but couldn't get it
    to work. Can someone tell me if I should use OR - or is this even the right
    way to search through more than one field? I have Ben Forta's web application
    construction book but can't find an example.


    Nat5 Guest

  7. #6

    Default Re: Querying multiple fields

    First off, you wouldn't use EQ when comparing your database field against a
    value, but would use = instead.

    Perhaps, something like this:

    <cfif isDefined("Form.ID") AND '#Form.ID#' is not "">
    AND applicantTracking.ID = '#form.ID#'
    </cfif>
    <cfif isDefined("Form.certarea")>
    AND (appCert.cert1Area = '#form.certarea#'
    OR appCert.cert2Area = '#form.certarea#'
    OR appCert.cert3Area = '#form.certarea#'
    OR appCert.cert4Area = '#form.certarea#'
    OR appCert.cert5Area = '#form.certarea#'
    OR appCert.cert6Area = '#form.certarea#')
    </cfif>

    Phil

    paross1 Guest

  8. #7

    Default Re: Querying multiple fields

    This works! Thanks!:)
    Nat5 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