|
Posted by Erland Sommarskog on 06/19/06 21:58
Jeff Kish (jeff.kish@mro.com) writes:
> Some helpful person (thanks m cadot) in the Oracle group gave me some
> guidance and made an initial suggestion which I show here, and a more
> advanced solution I'm not showing because I don't understand it, and it
> might be oracle specific.
>
> select object, keyseq, count(keyseq)
> from metatable
> where keyseq is not null
> group by object, keyseq
> having count(*) > 1 ---<----- just this line to add
> order by count(keyseq)
It can't be any more standard SQL than this. The above SELECT should
run on any RDBMS that supports SQL.
HAVING is like WHERE, but is applied after the GROUP BY, and thus
permits filters with aggregate functions.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Navigation:
[Reply to this message]
|