Hello, I need some help whith a mysql-query. Can anyone help? Is there a good newsgroup for mysql?
Identifiseringid is the primary key of the table identifisering and is autoincrement. There is also a coloumn named dprosjekt in identifisering and some other coloumns. dprosjekt has the same value for several tuples. For each unike dprosjekt I want to print the record where identifiseringid is max. 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); When I split the query they work: SELECT * FROM identifisering as i WHERE i.identifiseringid='123'; SELECT MAX(ii.identifiseringid) FROM identifisering as ii GROUP BY dprosjekt; Thanks, Lars -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php