Hello! Francisco Reinaldo wrote:
>Hi, > >Since subqueries are not allowed in MySQL, this is >what I would do: > >Create a temporary table with the id's containing >multiple dates. >Inner join your table with the temporary table. > >Even if MySQL allowed subqueries, this is what will >probably happen behind the scene. > >Bye and Good Luck! >--- Mihail Manolov <[EMAIL PROTECTED]> wrote: > > >>:) Is this some sort of a joke? >> >>I am grouping using event_id, which makes your query >>useless because it will >>return just the first time row per each event_id. >> >>Thanks anyway. I may have to use second query... :-( >> >> >>Mihail >> >> >>----- Original Message ----- >>From: "Bhavin Vyas" <[EMAIL PROTECTED]> >>To: "Mihail Manolov" <[EMAIL PROTECTED]>; >><[EMAIL PROTECTED]> >>Sent: Thursday, July 11, 2002 10:51 PM >>Subject: Re: Help - query suggestion needed - >>interesting case >> >> >> >> >>>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 >>>> >>>> >>>> How about SELECT event_id, time FROM events GROUP BY event_id, time HAVING count(*) > 1 ; ??? >> >> >> >> > > > -- Ralf Narozny SPLENDID Internet GmbH & Co KG Skandinaviendamm 212, 24109 Kiel, Germany fon: +49 431 660 97 0, fax: +49 431 660 97 20 mailto:[EMAIL PROTECTED], http://www.splendid.de --------------------------------------------------------------------- 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