pingLeeQuan
Programmer
Sorry if this post needs to be in the sql group.
I am trying to update bunch of records in the same table with a value from one of those records.
I have n records of which i have x that have blank ssnumber.
These x records belong to multiple categories.
I need to be able to update group x records category "A" with values from x records (there should be a record in each group that has a valid value to populate the others)
And the same applies for the other categories.
I can select * from table order by category and then the value. Then i can have a loop to pick and update each one. I do not think this is efficient.
Is there a better way to handle this? I started brain storming but i could not glow it together.
I user a select * from ... order by category, value DESC
then I used filtering
then I used update... that’s when I lost it.
If I use Group by on filtering to update a whole bunch of records per category.... would this work... how?
Thanks in advance..
Quan
I am trying to update bunch of records in the same table with a value from one of those records.
I have n records of which i have x that have blank ssnumber.
These x records belong to multiple categories.
I need to be able to update group x records category "A" with values from x records (there should be a record in each group that has a valid value to populate the others)
And the same applies for the other categories.
I can select * from table order by category and then the value. Then i can have a loop to pick and update each one. I do not think this is efficient.
Is there a better way to handle this? I started brain storming but i could not glow it together.
I user a select * from ... order by category, value DESC
then I used filtering
then I used update... that’s when I lost it.
If I use Group by on filtering to update a whole bunch of records per category.... would this work... how?
Thanks in advance..
Quan