Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SELECTing the newest column in the table

Author  Topic 

cyx
Starting Member

9 Posts

Posted - 2001-01-02 : 09:13:13
Hello everyone!
I have a table with these columns: ID, RATE, DATE_CHANGED
Now, there might be alot of RATEs there with the same ID, but DATE_CHANGED will always hold the date when the rate was entered.

I want to select from this table the newest rate matching an ID.
I tried doing it like this:

SELECT DISTINCT coin_id, MAX(mcr.date_changed), mcr.rate
FROM mall_coins_rate WHERE coin_id = 2

And it just won't work!
And I DO NOT want to use a subquery...


----------------------
Rafi B., Israel.
   

- Advertisement -