Question
cfloop help
I posted this previously and still do not know how to do it,
so I will post again with another example.
We have a table on sql server. The table contains an order number and one or more part numbers for that order. We added a new column called line item, currently set at NULL. What I need to do is update the line item for each part number, per order. For example, if order number 1 has 3 part numbers, then the line item should be 1, 2, and 3. If the next order 2 has 5 part numbers, then the line items should be 1,2,3,4,5. If the next order has 2 part number, then the line items should be 1,2...etc.
What I tried to do was count(order) as totalcount then group by order. This would give me the total line items for each order. I then tried to use cfloop from=1 to=totalcount index=i, and loop thru the update, with set lineItem = lineitem + 1 (line items are updated from NULL to 0), and where order = #qry.order#
I was hoping that the first time around, it would update the first order number up to the max, then switch and go to the next order number, etc. But what is happening is that if the order has 3 part numbers, it will update the line item of the first part number to 3, and the other 2 remain 0.
What is the proper cfloop setup to do what I need to do, or is there another better method to update the line items ?
Thanks for any help.
We have a table on sql server. The table contains an order number and one or more part numbers for that order. We added a new column called line item, currently set at NULL. What I need to do is update the line item for each part number, per order. For example, if order number 1 has 3 part numbers, then the line item should be 1, 2, and 3. If the next order 2 has 5 part numbers, then the line items should be 1,2,3,4,5. If the next order has 2 part number, then the line items should be 1,2...etc.
What I tried to do was count(order) as totalcount then group by order. This would give me the total line items for each order. I then tried to use cfloop from=1 to=totalcount index=i, and loop thru the update, with set lineItem = lineitem + 1 (line items are updated from NULL to 0), and where order = #qry.order#
I was hoping that the first time around, it would update the first order number up to the max, then switch and go to the next order number, etc. But what is happening is that if the order has 3 part numbers, it will update the line item of the first part number to 3, and the other 2 remain 0.
What is the proper cfloop setup to do what I need to do, or is there another better method to update the line items ?
Thanks for any help.
