Assuming that the lastest ID is the same as the current name - maybe something 
like : 

select * from sometab t1 
where id=(
        select max(id) from sometab t2 where t1.code=t2.code
)


On Thursday 13 July 2006 10:16, Helen M Hudson wrote:
> If I have a table
> primary key id   |  code            | name
> 1                       |  ABC           | company 1 name
> 2                       |  ABC           | company 1 name
> 3                       |  ABC           | new company 1 name
> 4                       |  ABC           | new company 1 name
> 5                       |  DEF            | company 2 name
> 6                       |  DEF            | company 2 name
> 7                       |  DEF            | new company 2 name
> 8                       |  DEF            | new company 2 name
>
> (the company is changing name every now and then and i need to extract
> their "latest" name)
>
> how can i get back
> 4                       |  ABC           | new company 1 name
> 8                       |  DEF            | new company 2 name

-- 
Mike Aubury


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

Reply via email to