At 18:29 20.11.2002, Ryan Gallagher said:
--------------------[snip]--------------------
>SELECT * FROM identifisering as i
>WHERE i.identifiseringid = (
>    SELECT MAX(ii.identifiseringid) AS maxIdentifiseringid
>    FROM identifisering as ii
>  )
>GROUP BY dprosjekt
>
>Now that I look at it, your GROUP BY was definitely out of place, since
>dprosjekt no doubt is a col being returned from the SELECT * of the main
>query.
--------------------[snip]-------------------- 

No, it wasn't.
You need the GROUP BY in the subquery to retrieve the max(id) for any
distinct dprosjekt. If you have it like you did the subquery would simply
return a single result, the max(id) of all records. Your version simply
functions as an "order by" which is useless here since only a single record
will be returned.


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to