Quoting Ernest E Vogelsinger <[EMAIL PROTECTED]>:

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

Sorry, that's what I was trying to decipher... The '=' combined with the use of
MAX led me to believe the desired recordset size was ONE in the sub query.

Ryan T. Gallagher
International Studies Abroad

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

Reply via email to