Lets say I have a table that looks like the following;
version_number ID Value
1 33 Foo
2 33 Bar
1 37 Foo
How would I return the Value field from the table if the ID was 33 and only select from the Maximum version number? (In this case, 2)
Something like;
SELECT Value FROM Table WHERE ID = 33 and MAX(version_number)
EDIT: Both answers below work. I'm going with Tim Schmelter's answer just because I think its a little more elegant, but I've up voted them both. Thanks guys :)