Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Use multiple partitions on a table in query

Sandyboy036Mar 12 2012 — edited Mar 12 2012
Hi All,

Overview:-
I have a table - TRACK which is partitioned on weekly basis. Im using this table in one of my SQL queries in which I require to find a monthly count of some column data. The query looks like:-
Select  count(*)
from Barcode B
inner join Track partition P(99) T
    on B.item_barcode = T.item_barcode
where B.create_date between 20120202 and 20120209;
In the above query I am fetching the count for one week using the Partitions created on that table during that week.


Desired output:-
I want to fetch data between 01-Feb and 01-Mar and use the rest of the partitions for that table during the duration in the above query. The weekly partitions currently present for Track table are -
P(99) - 20120202
P(100) - 20120209
P(101) - 20120216
P(102) - 20120223
P(103) - 20120301

My question is that above Ive used one partition successfully, now how can I use the other 4 partitions in the same query if I am finding the count for one month (i.e. from 201201 to 20120301) ?

Environment:-
Oracle version - Oracle 10g R2 (10.2.0.4)
Operating System - AIX version 5

Thanks.

Edited by: Sandyboy036 on Mar 12, 2012 10:47 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 9 2012
Added on Mar 12 2012
2 comments
1,336 views