Re: Can I do this using SQL?
From: -CELKO- <jcelko212_at_earthlink.net>
Date: 9 Feb 2006 18:55:28 -0800
Message-ID: <1139540128.434166.136380_at_g44g2000cwa.googlegroups.com>
Date: 9 Feb 2006 18:55:28 -0800
Message-ID: <1139540128.434166.136380_at_g44g2000cwa.googlegroups.com>
I assume that a big balance is how you rate the branches.
DECLARE BestTenBranches CURSOR FOR
The TOP n operator is a SQL Server extension, but you can do this with
SELECT branch_name, SUM(acct_balance) AS activity_tot, COUNT(cust_id)
AS cust_tally
FROM BranchActivity
GROUP BY branch_name
ORDER BY activity_tot;