从表格中获取日期最长的标题 [英] fetch title which date is maximum from table
本文介绍了从表格中获取日期最长的标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个表,其中有两个列标题和日期.所以我想从该表中获取最大日期的标题.所以我将使用哪个查询.
喜欢...
从表名中选择col1,其中date = max(date)....
给出错误...
请帮忙...
谢谢...
Mitesh
i have a table in which there is two column title and date. so i want to get the title which date is maximum from that table. so which query i will use.
like...
select col1 from tablename where date=max(date)....
gives error...
please help...
Thanksss...
Mitesh
推荐答案
尝试一下:
Try this:
SELECT col1 FROM Table1
WHERE (SELECT MAX(DATE) FROM Table1)
还是这个
Or this
SELECT a.id, a.grp, a.date
FROM table a, (SELECT grp, max(date) AS max_date FROM table GROUP BY grp) b
WHERE a.grp = b.grp AND a.date = b.max_date
还是这个
Or this
SELECT grp, max(date) as max_date FROM table GROUP BY grp
这篇关于从表格中获取日期最长的标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文