sql - Update table values using 2 tables -
i have 2 tables follows:
comment text
record_id_fk sort_order comment_text ----------------------------------------- 101 1 test text 101 1 more test text 101 1 more... 101 2 more... 101 2 more... 101 2 more... 101 2 more... 101 3 more... 101 3 more... 101 3 more... 102 1 test text 102 1 more test text 102 1 more... 102 2 more... 102 2 more... 102 2 more... 102 2 more... 102 3 more... 102 3 more... 102 3 more...
products
product_id sort_order record_id_fk ----------------------------------------- 111 1 101 222 2 101 333 3 101 444 1 102 555 2 102 666 3 102
i need able change sort order of comments values supplied form. sort_order entry in comments table can swapped around, sort_order value 3 can swapped value 2, or sort_order value 1's can swapped value 2 , value 2 can swapped value 3 etc etc.
the function update sql reside excepts sort_order , product_id value , hit each time via loop in action file.
i have tried using sql update statement , using exists() looking see if product_id exists , joining record_id , sort_order fails sort_order changed next row change fails sort_order no longer valid.
i don't think acheivable have here, limited how can link 2 tables change sort_order en masse.
i using oracle 11g , coldfusion 9.
any ideas appeciated or confirmation not possible have here.
thanks
jc
Comments
Post a Comment