Hi Friends,

I am confused how to add paritions group summation.
Example:
SALES table: partitioned by sales_date (by year)
Number of rows: 40 Million average of 4 million a year (per partition)
One of its columns is product_type. (not indexed)

Problem:

I want to count products_type sold from june 2005 to june 2006
group by product type;

I have to use the partition coz the column product_type is not indexed.

select product_type,count(*) from SALES partition(SALES2005)
where sales_date>='01-JUN-05' group by product_type
UNION ALL
select product_type,count(*) from SALES partition(SALES2006)
where sales_date<='30-JUN-06' group by product_type
/

Is the above code valid? can i use union all to add the two groups?


Thanks