SELECT dr.region,
sum(case when dt.bus_date=current_date-1 AND dt.time_id=f.time_id then f.sales end )as "Yesterday",
sum(case when dt.bus_date between date_trunc('month',current_date) AND current_date AND dt.time_id=f.time_id then f.sales end )as "Month",
sum(case when dt2.time2_id=f2.time2_id and dt2.time2_id=(SELECT extract(month FROM(current_date))) then f2.sales_target end )as "Target" from
fact_sales f,dim_time dt,fact_sales_target f2,dim_region dr,dim_time2 dt2 where f.region_id=dr.region_id and dr.region_id=f2.region_id GROUP BY dr.region;