How about:

 SELECT
     event_id, time,
     count(DISTINCT time) AS Ranges
 FROM
     events
 GROUP BY
     event_id HAVING Ranges > 1


----- Original Message -----
From: "Mihail Manolov" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 11, 2002 2:58 PM
Subject: Help - query suggestion needed - interesting case


> Greetings,
>
> I am stuck with this problem:
>
> I have the following table:
>
> event_id   time
> 100        2000-10-23
> 100        2000-10-23
> 101        2000-10-24
> 101        2000-10-25
>
> I need to know all event_id's that have multiple times + time columns. Is
it
> possible to get that result in just one query?
> The result should be something like this:
>
> event_id   time
> 101        2000-10-24
> 101        2000-10-25
>
>
> I managed to get all event_id's that have multiple times, but I don't know
> how to get the time column in the same query.
> Here is my current query:
>
> SELECT
>     event_id,
>     count(DISTINCT time) AS Ranges
> FROM
>     events
> GROUP BY
>     event_id HAVING Ranges > 1
>
> Please help me to find a single query that will return the time column as
> well.
>
>
> Mihail
>
>
>
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to