Avoiding temp tables
Posted in 1994
Is there a way to avoid using temporary tables when you do a
group by on more than table?
The query is as follows:
QUERY:
------
select stgactvd.acct_no, stgactvd.department,
stxchrtr.acct_desc, sum(stgactvd.amount),debit_credit
from stgtranr, stxtranr, stgactvd, stxchrtr
where stgtranr.doc_no = stxtranr.doc_no and
stgtranr.doc_no = stgactvd.doc_no and
stgtranr.orig_journal = stxtranr.orig_journal and
stxtranr.doc_no = stgtranr.doc_no and
stgtranr.orig_journal = stgactvd.orig_journal and
stgactvd.acct_no in
(select distinct acct_no from
monietbl where rpt_3_grp = "Insurance" ) and
stxtranr.orig_journal <> "YE" and
stgactvd.department matches "100" and
stxtranr.doc_date >= "020194" and
stxtranr.doc_date <= "022894" and
stxchrtr.acct_no = stgactvd.acct_no
group by 1,2,3,5
The optimizer creates a temp table for the group by clause.
Is there a way i can avoid this?
Thank you,
toby Denbow
tdenbow@mathworks.com