Hi muhammad12,
Please refer below SQL query.
SQL
CREATE TABLE #Flight
(
[FlightDate] DATETIME
,[FlightNo] VARCHAR(20)
,[Description] VARCHAR(20)
,[arr] VARCHAR(20)
)
INSERT INTO #Flight ([FlightDate],[FlightNo],[Description],[arr])
VALUES('2022-12-18','a320','dxb','rdh')
INSERT INTO #Flight ([FlightDate],[FlightNo],[Description],[arr])
VALUES('2022-12-17','a68','lkg','rdh')
INSERT INTO #Flight ([FlightDate],[FlightNo],[Description],[arr])
VALUES('2022-12-16','ak47','dhd','mum')
INSERT INTO #Flight ([FlightDate],[FlightNo],[Description],[arr])
VALUES('2022-12-18','a43','dxb','jdh')
INSERT INTO #Flight ([FlightDate],[FlightNo],[Description],[arr])
VALUES('2022-12-15','a280','fgh','hyr')
INSERT INTO #Flight ([FlightDate],[FlightNo],[Description],[arr])
VALUES('2022-12-14','a360','gsr','che')
SELECT * FROM #Flight
WHERE FlightDate IN (SELECT MAX(FlightDate) FROM #Flight)
DROP TABLE #Flight
Output
FlightDate |
FlightNo |
Description |
arr |
18-12-2022 00:00 |
a320 |
dxb |
rdh |
18-12-2022 00:00 |
a43 |
dxb |
jdh |