Re: Counting propositions
From: --CELKO-- <jcelko212_at_earthlink.net>
Date: 20 Jun 2004 16:59:45 -0700
Message-ID: <18c7b3c2.0406201559.abc7897_at_posting.google.com>
Date: 20 Jun 2004 16:59:45 -0700
Message-ID: <18c7b3c2.0406201559.abc7897_at_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 Mon Jun 21 2004 - 01:59:45 CEST