Update multiple rows in single column
772647May 12 2010 — edited May 12 2010I have table grocery_05support_measures with the following attributes:
ID
antecedent
consequent
coverage
All values in the coverage column are currently null for all records. The table has > 37k rows. I would like to update this column to store a probability calculation, which will be different for each row in the table. I have the following:
update grocery_05Support_measures
set coverage = select count(antecedent)/(Select count(antecedent)
from grocery_05Support) * 100
from grocery_05Support
group by antecedent);
The subquery, of course, returns multiple rows. Could anyone provide any assistance how it can be rewritten in order to update current existing rows with the appropriate calculated value? Any assistance is greatly appreciated.