rendered paste bodyteleview=# \d dim_time;
Table "public.dim_time"
Column | Type | Modifiers
-------------+----------+------------------------------------------------------------
time_id | integer | not null default nextval('dim_time_time_id_seq'::regclass)
bus_date | date | not null
bus_day | smallint | not null
bus_month | smallint | not null
bus_quarter | smallint | not null
bus_semi | smallint | not null
bus_year | integer | not null
Indexes:
"dim_time_pkey" PRIMARY KEY, btree (time_id)
teleview=# \d dim_time2;
Table "public.dim_time2"
Column | Type | Modifiers
-------------+----------+--------------------------------------------------------------
time2_id | integer | not null default nextval('dim_time2_time2_id_seq'::regclass)
bus_month | smallint | not null
bus_quarter | smallint | not null
bus_semi | smallint | not null
bus_year | integer | not null
Indexes:
"dim_time2_pkey" PRIMARY KEY, btree (time2_id)
teleview=# \d fact_sales;
Table "public.fact_sales"
Column | Type | Modifiers
---------------+---------+--------------------------------------------------------------------
fact_sales_id | integer | not null default nextval('fact_sales_fact_sales_id_seq'::regclass)
time_id | integer | not null
region_id | integer | not null
dealer_id | integer | not null
product_id | integer | not null
contract_id | integer | not null
promotion_id | integer | not null
sales | real | not null
Indexes:
"fact_sales_pkey" PRIMARY KEY, btree (fact_sales_id)
"ix_fact_sales_fact_sales_id" btree (fact_sales_id)
Foreign-key constraints:
"fact_sales_contract_id_fkey" FOREIGN KEY (contract_id) REFERENCES dim_contract(contract_id)
"fact_sales_dealer_id_fkey" FOREIGN KEY (dealer_id) REFERENCES dim_dealer(dealer_id)
"fact_sales_product_id_fkey" FOREIGN KEY (product_id) REFERENCES dim_product(product_id)
"fact_sales_promotion_id_fkey" FOREIGN KEY (promotion_id) REFERENCES dim_promotion(promotion_id)
"fact_sales_region_id_fkey" FOREIGN KEY (region_id) REFERENCES dim_region(region_id)
"fact_sales_time_id_fkey" FOREIGN KEY (time_id) REFERENCES dim_time(time_id)
teleview=# \d fact_sales_month_agg;
Table "public.fact_sales_month_agg"
Column | Type | Modifiers
-------------------------+---------+----------------------------------------------------------------------------------------
fact_sales_month_agg_id | integer | not null default nextval('fact_sales_month_agg_fact_sales_month_agg_id_seq'::regclass)
time2_id | integer | not null
region_id | integer | not null
dealer_id | integer | not null
product_id | integer | not null
contract_id | integer | not null
promotion_id | integer | not null
sales | real | not null
prediction | real | not null
trend | real | not null
avcpv | real | not null
nonusage | real | not null
qosales | real | not null
rank | real | not null
Indexes:
"fact_sales_month_agg_pkey" PRIMARY KEY, btree (fact_sales_month_agg_id)
Foreign-key constraints:
"fact_sales_month_agg_contract_id_fkey" FOREIGN KEY (contract_id) REFERENCES dim_contract(contract_id)
"fact_sales_month_agg_dealer_id_fkey" FOREIGN KEY (dealer_id) REFERENCES dim_dealer(dealer_id)
"fact_sales_month_agg_product_id_fkey" FOREIGN KEY (product_id) REFERENCES dim_product(product_id)
"fact_sales_month_agg_promotion_id_fkey" FOREIGN KEY (promotion_id) REFERENCES dim_promotion(promotion_id)
"fact_sales_month_agg_region_id_fkey" FOREIGN KEY (region_id) REFERENCES dim_region(region_id)
"fact_sales_month_agg_time2_id_fkey" FOREIGN KEY (time2_id) REFERENCES dim_time2(time2_id)
now i want to load all the data from the fact_sales in month wise aggreated form of sales