Skip to content
Advertisement

Retrieving the latest result in sql

I have written sql query that is pulling agreements data. I need to pull the latest agreement. The latest version is determined based on the most recent version. As you can see currently my query is displaying two records. Please note that version is varchar field

Query

enter image description here

As you can see there are two versions. I need my query should pull only 2.1.0.000 version. Do I need to do max of the version or any other way ? If I do Max() , it shows the latest record on the top but i need only the latest and not the second record

Advertisement

Answer

You can use top (1) :

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement