简体   繁体   中英

SQL-query for latest date in data base

Can You help me construct sql query which pulls out of database the entries which have the latest date.

I tried but come to deadend

SELECT *
FROM Table t,Table t2
WHERE t.date>t2.date

I think i have to use some temporary tables...it is a bit dificult for me

Retrieve rows ordered by date, descending:

SELECT * FROM table ORDER BY date DESC

Retrieve the 5 rows with the most recent dates:

SELECT * FROM table ORDER BY date DESC LIMIT 5

尝试:

select * from Table where date_column = (select max(date_column) from Table)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM