List:General Discussion« Previous MessageNext Message »
From:Octavian Rasnita Date:February 22 2006 12:59pm
Subject:selecting based on a max() condition
View as plain text  
Hi,

I have a table with 3 relevant columns:
symbol varchar(10) not null
price decimal not null
and
last_update datetime not null

I want to select the list of unique symbols and the corresponding price and
last_update fields for each line where the last_update is equal to the
last_update field for each symbol.

I have tried without succes:

select symbol, price, last_update from table where last_update =  (select
max(last_update) from table);

This gave me a single row. I have tried more complex queries that took a lot
of time and I needed to break them with ^C.

Thank you.

Teddy

Thread
selecting based on a max() conditionOctavian Rasnita22 Feb
  • Re: selecting based on a max() conditionPeter Brawley22 Feb