Re: Help - query suggestion needed - interesting case

2002-07-15 Thread Ralf Narozny

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
>>>>1002000-10-23
>>>>1002000-10-23
>>>>1012000-10-24
>>>>1012000-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
>>>>1012000-10-24
>>>>1012000-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




Re: Help - query suggestion needed - interesting case

2002-07-15 Thread Francisco Reinaldo

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
> > > 1002000-10-23
> > > 1002000-10-23
> > > 1012000-10-24
> > > 1012000-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
> > > 1012000-10-24
> > > 1012000-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
> 


__
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com

-
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




Re: Help - query suggestion needed - interesting case

2002-07-12 Thread Ralf Narozny

How about:

SELECT
e1.event_id,
e1.time,
count(distinct e2.time)
FROM
events e1
LEFT JOIN events e2 USING (event_id)
GROUP BY
e1.event_id,
e1.time,
e2.event_id
HAVING
count(e2.time_id) > 1
;

I don't know if this one does it too (might work in strange MySQL SQL ;-) )

SELECT
event_id,
time
FROM
events
GROUP BY
event_id,
time
HAVING
count(time) > 1
;

Mihail Manolov 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
>>>1002000-10-23
>>>1002000-10-23
>>>1012000-10-24
>>>1012000-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
>>>1012000-10-24
>>>1012000-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
>
>  
>

-- 
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




Re: Help - query suggestion needed - interesting case

2002-07-11 Thread Mihail Manolov

:) 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
> > 1002000-10-23
> > 1002000-10-23
> > 1012000-10-24
> > 1012000-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
> > 1012000-10-24
> > 1012000-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




Re: Help - query suggestion needed - interesting case

2002-07-11 Thread Bhavin Vyas

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
> 1002000-10-23
> 1002000-10-23
> 1012000-10-24
> 1012000-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
> 1012000-10-24
> 1012000-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




Help - query suggestion needed - interesting case

2002-07-11 Thread Mihail Manolov

Greetings,

I am stuck with this problem:

I have the following table:

event_id   time
1002000-10-23
1002000-10-23
1012000-10-24
1012000-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
1012000-10-24
1012000-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