At 04:57 18.11.2002, Lars Espelid said: --------------------[snip]-------------------- >I tought this would work, but it won't: > >SELECT * FROM identifisering as i >WHERE i.identifiseringid=(SELECT MAX(ii.identifiseringid) >FROM identifisering as ii >GROUP BY dprosjekt); > >also tried: > >SELECT * FROM identifisering as i >WHERE i.identifiseringid IN (SELECT MAX(ii.identifiseringid) >FROM identifisering as ii >GROUP BY dprosjekt); --------------------[snip]--------------------
The only thing I can say the second form (using IN) works like a charm in PostgreSQL: select * from identifisering as i where i.identifiseringid in ( select max(ii.identifiseringid) from identifisering as ii group by ii.dprosjekt ); If it doesn't work in MySQL it must be one of the unfortunately numerous shortcomings of MySQL. I always suggest using PostgreSQL in favour of MySQL; it's OS as well, it's mature, it's fast (faster than MySQL AFAIK), etc etc. And it comes bundled with at least RedHat, but I believe it's available with most Linux distros. -- >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