Reply to Re: difficult summing query

Your name:

Reply:


Posted by Erland Sommarskog on 11/29/05 00:22

(jmartineau@gmail.com) writes:
> Ah, this sort of thing is exactly what I need. However, when I modified
> the query you gave to fit the particular table names, etc, I now have
> an error: "Missing Keyword" at this point:
>
> FROM LoanBalanceTable) AS b ON a.Account# = b.Account#
> **
>
> Do you know what would cause this? Thanks,

When I run the query:

SELECT a.CustomerID, SUM(b.DepositBalance), SUM(b.LoanBalance)
FROM All_Accounts a
JOIN (SELECT Account#, DepositBalance, LoanBalance = 0
FROM DepositBalanceTable
UNION ALL
SELECT Account#, 0, LoanBalance
FROM LoanBalanceTable) AS b ON a.Account# = b.Account#
GROUP BY a.CustomerID

All I get is complaints on the tables missing.

But I don't recognize the error message "Missing keyword". Are you
really using Microsoft SQL Server?


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

[Back to original 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

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