Brilliant. Thanks a million. It's moments like these when I love the
internet.


Igor Tandetnik wrote:
> 
> zipforbrains <[email protected]> wrote:
>> I have two tables, one with bank accounts, one which holds groupings of
>> those
>> accounts, as follows:
>> Table Accounts
>> aName
>> aBalance
>> 
>> Table GroupMembers
>> gName
>> aName
>> 
>> What SQL query would total the account balances (aBalance) for all the
>> accounts (aName) associated with each group (gName)?
> 
> select gName, sum(aBalance)
> from Accounts a join GroupMembers g on (a.aName = g.aName)
> group by gName;
> 
> -- 
> Igor Tandetnik
> 
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Help-with-simple-query-tp29293030p29293103.html
Sent from the SQLite mailing list archive at Nabble.com.

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to