Skip to content
Advertisement

How to get the most recent data from a table?

Here is the table that I have

The question that I have for my query is “Using the most recent month of data available, what is the range of estimated home values across the nation?

Since my table is small, I know the recent date is 2020-06.

So I wrote this code:

And the result that I get is:

Another method of code that I wrote is:

And I get the same result as above. But none of this two code is feasible if I have a big amount of data. So my question is, how can I get the most recent data without manually typing out the specific?

The sql fiddle is here

Advertisement

Answer

You can use a subquery:

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