資料庫中有這樣的一張表,現在要查詢日期最大的那條資料。

select name,max(gmt_create) from user
複製程式碼
得到結果:

select a.name,max(a.gmt_create) from user a,
(select name,max(gmt_create) max_day from user ) b
where a.gmt_create=b.max_day
複製程式碼
得到結果:

資料庫中有這樣的一張表,現在要查詢日期最大的那條資料。
select name,max(gmt_create) from user
複製程式碼
得到結果:
select a.name,max(a.gmt_create) from user a,
(select name,max(gmt_create) max_day from user ) b
where a.gmt_create=b.max_day
複製程式碼
得到結果: