SELECT accounts.lconm, accounts.netname, accounts.adress, totsls.total
FROM accounts
INNER JOIN (SELECT activestb, SUM(billamnt) AS total
FROM bills
GROUP BY bils.acc) totals ON totals.acc = accounts.acc
WHERE acc = 1
I want to sum of billamnt which is in the second table(bills
) with this query but I m getting an error in SQL Server compact edition 2008.
The error message is :
Major Error 0x80040E14, Minor Error 25515 select accounts.lconm,accounts.netname, accounts.adress, totsls.total from accounts left outer join (select activestb, sum(billamnt) as total from bills group by bils.acc)totals on totals.acc=accounts.acc where acc=1
In aggregate and grouping expressions, the SELECT clause can contain only aggregates and grouping expressions. [ Select clause = ,activestb ]