× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Lloyd,

I use MSQuery all the time and have used derived tables a number of times.

lgoodbar@xxxxxxxxxxxxxx wrote:
Sorry about PRODO. Following your suggestion, starting with:

with temp as
(select nxkjdt, nxjpt2, sum(NXS7FQ) tran
from VNGDBDTA.DBNXCPP
where nxkjdt between 1070301 and 1070307
group by nxkjdt, nxjpt2),
temp2 as
(select dmatdt, dmekcd, sum(dmgzfq) prod
from VNGDBDTA.DBDMREP
where dmqwtx = 'SFR' and dmcdcd = ';MRCT' and
dmatdt between 1070301 and 1070307
group by dmatdt, dmekcd
)
select dmatdt, dmekcd, prod, tran
from temp2
left outer join temp on dmatdt = nxkjdt and dmekcd = nxjpt2
order by 1,2

I think the answer is the same for all of your examples:

Change this line:
select nxkjdt, nxjpt2, sum(NXS7FQ) tran
        to
select nxkjdt, nxjpt2, sum(NXS7FQ) as tran

and you should be fine.

Bill 



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.