现有如下数据
table
id date value
1 2005-1-1 xxxx
1 2005-2-2 xxxx
2 2005-1-1 xxxx
2 2005-2-2 xxxx
3 2005-1-1 xxxx
4 2005-2-2 xxxx
现在要根据ID,将每每个ID,最后发布的那条记录显示出来
结果
id date value
1 2005-2-2 xxxx
2 2005-2-2 xxxx
3 2005-2-2 xxxx怎么做呢
table
id date value
1 2005-1-1 xxxx
1 2005-2-2 xxxx
2 2005-1-1 xxxx
2 2005-2-2 xxxx
3 2005-1-1 xxxx
4 2005-2-2 xxxx
现在要根据ID,将每每个ID,最后发布的那条记录显示出来
结果
id date value
1 2005-2-2 xxxx
2 2005-2-2 xxxx
3 2005-2-2 xxxx怎么做呢
from table a,
(select id,max(date) date from table b group by id) b
where a.id=b.id and a.date=b.date