* heiko mundle > we use this table mobile_pos > > +---------+---------------------+---------------------+ > | team_id | time | geometry | > +---------+---------------------+---------------------+ > | 3 | 2003-01-28 16:17:06 | 727105 5282634 651 | > | 5 | 2003-01-28 16:19:22 | 728220 5282453 944 | > | 1 | 2003-01-28 17:08:24 | 728998 5283317 1423 | > | 3 | 2003-01-28 18:47:16 | 727805 5288644 772 | > | 5 | 2003-01-28 19:34:25 | 727228 5283755 815 | > | 1 | 2003-01-29 11:08:24 | 728938 5283467 1467 | > +---------+---------------------+---------------------+ > > how do I get the geometry for every team with every newest time? > > IF I do something like that, I will get the newest record, but > how can I get > the geometry of the record? > > SELECT team_id, MAX(time) FROM SAFETOUR_mobile_pos GROUP BY team_id;
Try the MAX-CONCAT trick, described in the manual: <URL: http://www.mysql.com/doc/en/example-Maximum-column-group-row.html > SELECT team_id, MAX(CONCAT(time,'|',geometry)) FROM SAFETOUR_mobile_pos GROUP BY team_id; -- Roger --------------------------------------------------------------------- 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