wiki:Module RHT

back to first page..
back to RHT

Integrating the "module" estimated by month

drop table if exists rht.attr_debit;
create table rht.attr_debit
(
  id_drain integer,
  janv numeric,
  fev numeric,
  mars numeric,
  avril numeric,
  mai numeric,
  juin numeric,
  juil numeric,
  aout numeric,
  sept numeric,
  oct numeric,
  nov numeric,
  dec numeric
);

---Open into access and export in csv before
copy rht.attr_debit from 'D:/CelineJouanin/RHT_Estimkart/attr_debitacc.csv' with csv delimiter as ';' header;

alter table rht.attr_debit rename column "dec" to decembre;

alter table rht.attr_debit add column module_oct_avril numeric;
update rht.attr_debit set module_oct_avril=sub.oct_avril from 
        (select id_drain, (avril+mai+juin+juil+aout+sept+oct)/7 as oct_avril from rht.attr_debit) as sub
        where attr_debit.id_drain=sub.id_drain; ---114564 lines
Last modified 13 years ago Last modified on Mar 8, 2012 3:00:15 PM