I Have this table in my DB:
Id Name Version AddedDate
1 Table 1 2020-02-26 15:25:04.5366703
2 Table 1 2020-02-26 15:25:01.8502928
3 Table 2 2020-02-26 15:18:09.0415632
4 Table 2 2020-02-26 15:18:23.6646620
5 Chair 1 2020-02-26 15:16:25.7518968
6 Chair 1 2020-02-26 15:18:49.1826797
7 Chair 2 2020-02-26 15:24:41.0905596
8 Chair 2 2020-02-26 15:24:37.4333049
I have tried this SQL query and it works partially, but i need the entire row including the id and it fails if i add the Id to the select.
I need to write an entity framework query such that the result has the last added Table 1, Table 2, Chair 1, Chair 2
SELECT [Name],[Version], MAX(AddedDate) as AddedDate
From JsonSchemas
GROUP BY Name, Version
ORDER BY MAX(AddedDate) DESC