Last post May 19, 2009 03:16 AM by Mikesdotnetting
May 18, 2009 07:49 AM|lindows|LINK
writing an sql below is self explained, but not sure why its not returning any rows
SELECT Branch.branch_name AS Branch, Sum(Account.balance) AS Balance, Sum(Loan.amount) AS Loan
FROM (Branch INNER JOIN Account ON Branch.branch_name = Account.branch_name) INNER JOIN Loan ON Branch.branch_name = Loan.branch_name
WHERE 'Sum(Loan.amount)' < 'Sum(Account.balance)'
GROUP BY Branch.branch_name;
May 18, 2009 08:57 AM|www.venkateswarlu.co.in|LINK
Sum(Loan.amount) , Sum(Account.balance)
which are mentioned in WHERE condition are in Single quote. If we mention any string with in Single quotes SQL treats it as a string. So remove the Single quote in where condition and then try, it will works.
May 18, 2009 09:44 AM|lindows|LINK
tried the following...
WHERE Sum(Loan.amount) < Sum(Account.balance)
May 19, 2009 03:16 AM|Mikesdotnetting|LINK
Run it in Access without the WHERE clause. See if you get what you expect.