>Hi
>SQL troubles:
>I have a table containing 4 columns: "name" - string, "distance"-
>double,
>"speed" - time and "id" - AUTO_INCREMENT (Primery key)
>I want a list of the fastest (speed) runner (name) of each distance and
>the
>speed.
>I use:
>select name, distance, min(speed) from table1 group by distance;
>I get a list where the speed and the distyance are always correct but
>the
>name is not always.
>Why is that?
>What should I do?
>
>Thanks,
>
>// Chris - Copenhagen

Sir, try
        SELECT t1.name, t1. distance, Min(t1.speed)
        FROM table1 t1, table1 t2
        WHERE  p1.name = p2.name
        GROUP BY t1.distance
        HAVING Min(t1.speed) = Min(t2.speed);
I haven't run this, but I think it's correct.

Bob Hall

Know thyself? Absurd direction!
Bubbles bear no introspection.     -Khushhal Khan Khatak
MySQL list magic words: sql query database

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