Skip to content
Advertisement

How to pull the latest records added in a table?

I want to pull the records associated with the latest VERSION_ID. FILE_EXTRACT_VERSION table looks like this:

FILE_EXTRACT_VERSION_SPECS table looks like this:

I want to write a query to pull records with the latest VERSION_ID (latest can be segregated by the latest date they have been added)

Here is what I have tried but it gives an error:

Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.

Please advise the right query to do this:

Advertisement

Answer

You can use a subquery to select the latest version_id, and filter the original table with the result:

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