need sql query for below data Declare @T table (ID int, [Name] varchar(5), [Date] Char(10), Amount int) 
insert into @T(id,  [Name],[Date],Amount) values
(1, 'A4', '01.01.2017', 100 ),
(2, 'B5', '01.01.2017', 80 ),
(3, 'A3', '01.01.2017', 110 ),
(4, 'A4', '01.04.2017', 95 ),
(5, 'A4', '10.10.2017', 105 ),
(6, 'B3', '10.10.2017', 110 ),
(7, 'B3', '15.11.2017', 100 ),
(8, 'B5', '15.11.2017', 95)


Need sql query for latest amount for name with respect to date
Try something like this (modify as needed):

Declare @T table (ID int, [Name] varchar(5), [Date] Char(10), Amount int) 
insert into @T(id,  [Name],[Date],Amount) values
(1, 'A4', '01.01.2017', 100 ),
(2, 'B5', '01.01.2017', 80 ),
(3, 'A3', '01.01.2017', 110 ),
(4, 'A4', '01.04.2017', 95 ),
(5, 'A4', '10.10.2017', 105 ),
(6, 'B3', '10.10.2017', 110 ),
(7, 'B3', '15.11.2017', 100 ),
(8, 'B5', '15.11.2017', 95)

;

--Formatting character date to YYYYMMDD
WITH _DataAndDateYYMMDD
AS (
    SELECT *
        ,substring([Date], 7, 4) + substring([Date], 1, 2) + substring([Date], 4, 2) AS DateYYYYMMDD
    FROM @T AS rn
    )
    ,_cte   --Use ROW_NUMBER and PARITION BY NAME ordering by date desc to get max date for each name
AS (
    SELECT *
        ,ROW_NUMBER() OVER (
            PARTITION BY [Name] ORDER BY DateYYYYMMDD DESC
            ) AS rn
    FROM _DataAndDateYYMMDD
    )
SELECT *
FROM _cte
WHERE rn = 1




| ID | Name | Date       | Amount | DateYYYYMMDD | rn |
|----|------|------------|--------|--------------|----|
| 3  | A3   | 01.01.2017 | 110    | 20170101     | 1  |
| 5  | A4   | 10.10.2017 | 105    | 20171010     | 1  |
| 7  | B3   | 15.11.2017 | 100    | 20171511     | 1  |
| 8  | B5   | 15.11.2017 | 95     | 20171511     | 1  |