例如现在表中的数据是这样的:
item_no item_name
W2014-01 测试1
W2014-01 测试1
W2014-03 测试3
W2014-02 测试2
我希望查询出来是这样的
item_no item_name
W2014-01 测试1
W2014-03 测试3
W2014-02 测试2
请问有现在方法解决!
------解决方案--------------------
按第三个字段排序可行,重复值可以这样处理:
select item_no ,item_name
from tb a
where exists (select 1 from (select item_no ,item_name,max(时间列) 时间列 from tb group by item_no ,item_name)b
where a.item_no =b.item_no and a.item_name=b.item_name and a.时间列=b.时间列)
order by 时间列