I have a fairly large table of data with multiple years worth of accounts with in it. I'm trying to write a query that will simple pull back the latest year. 

However I have tried a number of queries, some from this site that seem to work for other but I can not get it to work on my data set.

The table data looks like so:

[![Sample Data](https://i.stack.imgur.com/slX23.png)](https://i.stack.imgur.com/slX23.png)

So in this example I need to bring back the 2018 year only. The query that I thought might work was:

```
SELECT *
FROM dbo.Accounts A     
INNER JOIN  
    (SELECT [Account No], MAX(Year) AS MaxYear 
     FROM dbo.Accounts
     GROUP BY [Account No]) MaxYear ON A.[Account No] = MaxYear.[Account No] 
                                    AND A.Year = MaxYear.MaxYear

```

However this still provides me three records on the Max part when I look for the example account number above.

Any help would be much appreciated.

Thanks in advance

PS: The `Year` datatype is `Float` and `Account No` is `nvarchar(255)`