Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: Counting propositions

Re: Counting propositions

From: --CELKO-- <jcelko212_at_earthlink.net>
Date: 20 Jun 2004 16:59:45 -0700
Message-ID: <18c7b3c2.0406201559.abc7897@posting.google.com>


>> In fact, there ought never be any need to do 'distinct' at all. <<

Which theaters in my multiplex are showing (n) films all the time?

SELECT theater_nbr, MAX(movie_title)
  FROM MultiplexSchedule
 GROUP BY theater_nbr
HAVING COUNT(DISTINCT movie_title) = :n;

It is a good shorthand for situation which would otherwise require (SELECT DISTINCT...) AS X(..) derived tables and a few layers of nesting. Received on Sun Jun 20 2004 - 18:59:45 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US