विंडिंग फ़ंक्शन
WITH t AS (
SELECT *
,MAX(date) OVER(PARTITION BY id) max_date_by_id
FROM Item
)
SELECT *
FROM t
WHERE date = max_date_by_id
क्रॉस अप्लाई
SELECT *
FROM Item t
CROSS APPLY (
SELECT MAX(date) max_date_by_id
FROM Item
WHERE id = t.id
)
WHERE date = max_date_by_id