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)
 SQL Query

Author  Topic 

David Lay
Starting Member

4 Posts

Posted - 2001-08-03 : 00:42:48
I want to display the most current edit of a number of stories. For example if there where ten different stories each edited say 5 times, I would want to only display the latest edit of the ten stories. I developed the following SQL query to do this:

SELECT * FROM News
WHERE DateModified =
(SELECT MAX(DateModified)
FROM News WHERE StoryID = StoryThread)

I would use this SQL Query to get the latest story for the ThreadID. Then I would go through a loop and increment StoryThread by 1 to get the latest edit for each thread. I think that this would work but it seems clumsy to me. Can anyone tell me a better way to do this by, maybe, just using SQL.
   

- Advertisement -