数据如下:
id date fromId toId -------------------------------------- 1 2013-01-01 1 2 2 2013-01-02 2 1 3 2013-01-03 1 3 4 2013-01-04 3 1 5 2013-01-05 4 1 6 2013-01-06 1 4
例如,查询fromId或toId包含1,去除fromId和toId中数据互换的列,仅取日期最大的值,查询结果为:
id date fromId toId -------------------------------------- 2 2013-01-02 2 1 4 2013-01-04 3 1 6 2013-01-06 1 4