i have table temp:
id sentence pcount ncount 1 - 3 5 2 - 2 6 3 - 1 5 4 - 7 2
.....
i want create table above existing table should update when above table changes
new_temp ind_type index_val pcount sum(pcount) ncount sum(ncount)
is possible? please tell me how done.
don't create new table. create view:
create view new_temp select 'pcount' ind_type, sum(pcount) thecount temp union select 'ncount', sum(ncount) temp;
only create new table if need performance reasons.
if create new table, have write triggers temp
table when values change (insert
, update
, delete
). view simpler.
edit:
oh, misunderstood format table want. want 1 row 2 columns. easier:
create view new_temp select sum(pcount) pcount, sum(ncount) ncount temp;
Comments
Post a Comment