Quote:
Column 'CustomerTable.lblGBalance' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
According to your error encountered, you should also include the
CustomerTable.lblGBalance
column in you
Group By
Clause.
I've done this:
SELECT
(SELECT SUM(PU) FROM Entry WHERE TYPE = 'G') + A.PBalanceG AS BalanceG ,
(SELECT SUM(PU) FROM Entry WHERE TYPE = 'S') + A.PBalanceS AS BalanceS
FROM CustomerTable A
INNER JOIN ENTRY B ON A.CustomerCode = B.CustomerCode
WHERE A.CustomerCode = 'CS001'
AND B.Date = '2-10-13'
GROUP BY
A.PBalanceG, A.PBalanceS
Hope it helps! :)