List:General Discussion« Previous MessageNext Message »
From:Mike Aubury Date:July 13 2006 9:26am
Subject:Re: quickie for a non-blonde!
View as plain text  
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

Thread
summing valuesKathy Mazur Worden30 Jun
  • Re: summing valuesPeter Brawley30 Jun
    • RE: summing valuesKathy Mazur Worden30 Jun
  • quickie for a non-blonde!Helen M Hudson13 Jul
    • Re: quickie for a non-blonde!Mike Aubury13 Jul