You are here: Re: difficult summing query « MsSQL Server « IT news, forums, messages
Re: difficult summing query

Posted by jmartineau on 11/29/05 17:39

Nope, using Oracle9i. Does that change things? From what I could see
online, the "Missing keyword" error is a poorly defined syntax error of
some kind - something is/was wrong with my query and that is how it
told me so. However, I had modified the query in subtle ways to try to
make it work, so I'll backtrack a bit. Here's the query verbatim:

SELECT
AL1.INVOLVED_PARTY_ID_PRIMARY||','||SUM(B.DepositBalance)||','||SUM(B.LoanBalance)||','
FROM INFORMENT.PRODUCT_OFFER_PURCHASE AL1
JOIN (SELECT AL2.ACCOUNT_NUMBER, AL2.BAL_LEDGER_CURRENT AS
DepositBalance, LoanBalance = 0
FROM INFORMENT.DEPOSIT_BALANCE AL2
UNION ALL
SELECT AL3.ACCOUNT_NUMBER, 0, AL3.BAL_PRIN AS LoanBalance
FROM INFORMENT.LOAN_BALANCE AL3) AS B ON AL1.ACCOUNT_NUMBER =
B.ACCOUNT_NUMBER
GROUP BY AL1.INVOLVED_PARTY_ID_PRIMARY
ORDER BY 1;

This query is the closest I can get to mirroring your example code. It
produces a different error:

JOIN (SELECT AL2.ACCOUNT_NUMBER, AL2.BAL_LEDGER_CURRENT AS
DepositBalance, LoanBalance = 0
*
ERROR at line 3:
ORA-00923: FROM keyword not found where expected

The only real changes I made to the example you gave were to format the
output as a csv, and to try to change some of the names around. It
seems to be getting angry at the = 0 part, not sure why. One thing I
made different was that I pulled the balances AS the names LoanBalance
and DepositBalance, since by default they'd be less clear. I assume
this should have no impact on the query. Not quite sure what's
incorrect. Any more thoughts?

Thanks very much for your help thus far.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация