Re: SQL Query

From: Bob Hairgrove <rhairgroveNoSpam_at_Pleasebigfoot.com>
Date: Sun, 28 Oct 2001 14:34:25 GMT
Message-ID: <3bdbe93f.9014992_at_news.webshuttle.ch>


On Mon, 15 Oct 2001 15:45:01 GMT, "Patrick Pleass" <pat_at_pleass.com.au> wrote:

>Hi All,
>
>Single table (called activities) with fields day, start_time and duration. I
>want to find the number of distinct day and start_time combinations,
>ignoring the duration.
>
>In MySQL I would execute this:
>
>SELECT count(distinct day,start_time) FROM activities;
>
>Oracle only seems to allow a single field in a count statement. When I use
>count(*), the number returned includes all distinct durations as well.
>
>Can someone suggest a work-around?
>
>Thanks,
>
>Pat
>
>

SELECT day, start_time, count(*) FROM activities GROUP BY day, start_time;

Note there are additional ROLLUP and CUBE options (check your docs). Received on Sun Oct 28 2001 - 15:34:25 CET

Original text of this message