查询条件 from = a 下不重复的数据
T.where("from=?", "a").group("to").having("count(*) = 1").pluck("to")
若 from = a,to = xx 或者 from = xx,to = a 只算一条的话
T.where("not exist (select * from T t2 where t2.from = t.to and t2.to = t.from) ").group("from, to").having("count(*) = 1").pluck "from, to"