|
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]
|