| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Can I do this using SQL?
What, CELKO writing a cursor?
I'm shocked!
Is this one of the 'many' situations where properitary features come in to play while the standards committe catch up with stuff industry really needs.
In SQL Server you would write...
SELECT TOP 10 branch_name,
SUM(acct_balance) AS activity_tot,
COUNT(cust_id) AS cust_tally
FROM BranchActivity
Which gives you a result set you can use, whereas with standard SQL you would have to embed the SQL in the application (and not use stored procedures).
-- Tony Rogerson SQL Server MVP http://sqlserverfaq.com - free video tutorials "-CELKO-" <jcelko212_at_earthlink.net> wrote in message news:1139540128.434166.136380_at_g44g2000cwa.googlegroups.com...Received on Fri Feb 10 2006 - 02:25:49 CST
>I assume that a big balance is how you rate the branches.
>
> DECLARE BestTenBranches CURSOR FOR
> 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;
>
> The TOP n operator is a SQL Server extension, but you can do this with
> a cursor in Standard SQL, as shown.
>
![]() |
![]() |