Ask a Question related to Macromedia ColdFusion, Design and Development.

  1. #1

    Default cfloop and update

    I have a table with fields id, receiverid, cuid (customer unique id) and type.
    id is the primary key. Each receiverid is assigned to a single cuid BUT cuid
    can have one or more receiverid. I need to loop over the entire table and
    assign type of Primary to each record that has a 1 to 1 relationship. If the
    cuid has a multiple of receiverid's one type needs to be assigned primary and
    the remaining needs to be assigned secondary.

    Confused yet? (I am)

    So for example:
    Customer A has one receiver (one record in the table) so the type would be
    primary.
    Customer B has three receivers (three records in the table) so 1 record would
    have type assigned to Primary and record two and three would have the type
    assigned to secondary.

    Now for the million dollar question? Can it be done with cfloop and updating
    each record or do we have to do it manually?

    Thanks in advance for you help!

    Gary



    ghanna Guest

  2. Similar Questions and Discussions

    1. Access update, CFLOOP, number increment
      I have a table with four columns. field0 | field1 | field3 | field10 (primary key) L ABC 101 ...
    2. cfloop
      The goal is to insert a record into table 'atd', which contains a document id and an associate id, for each document (38) and associate (150). So...
    3. Cfloop..
      I am trying to loop over a list: <cfquery name="updsyllabus" datasource="#arguments.syl.dsn#"> UPDATE #arguments.syl.tname# SET <cfloop...
    4. Cfloop and list
      thru a form i recieve several list form.list1 ( 123,$15,000,$15,000,$15,000,x) form.list2 (456,$4,000,$15,000,$15,000,s form.list3...
    5. to cfloop or not to cfloop?
      :confused; I have a list of checkboxes from a form, and a submit button for "Batch Print" The var is "SelectList" and comes out as comma dilimited....
  3. #2

    Default Re: cfloop and update

    Is this a one time update? If so, instead of looping through each record, it
    would be more efficient to create a small sql script to do this, using a temp
    table perhaps and one or two update statements. It shouldn't be that complex.

    mxstu Guest

  4. #3

    Default Re: cfloop and update

    Thanks... We did it manually with a simple update record page. I don't know enough about SQL to write scripts.
    ghanna Guest

  5. #4

    Default Re: cfloop and update

    Glad you got your problem solved!
    mxstu 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