* Petre Agenbag
[...]
> This works:
>
> select distinct name, max(id) as mid from table group by name
>
> but it only returns the name and the highest id for such a name.
>
> if I try this:
>
> select distinct name, max(id) as mid, anything_else  from table group by
> name
>
> it returns the FIRST "anything_else", and not the value in the last row
> for that name ( as I would like it to)

Try the MAX-CONCAT trick:

select distinct name, max(concat(id,'|',anything_else,'|',even_more)) as
name_info
  from table group by name

Then you must programatically split the 'name_info' column back to the
individual fields, or use SUBSTRING, like in the example in the manual:

<URL: http://www.mysql.com/doc/en/example-Maximum-column-group-row.html >

HTH,

--
Roger


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to