一個表中將其中有兩個字段COL1,COL2. COL1有可能重複,COL2是一個日期字段.要求:如果COL1有重複,就取COL2時間最大的那條記錄.
------解决方案--------------------
select col1,max(col2)
from tablename
group by col1
------解决方案--------------------
select * from tuku where id in
(select max(id) as id from tuku group by Col1) order by COL2 desc