Select t1.name from t1
left outer join t2
on t1.name=t2.name
order by t2.age
谢谢你的回复 我问题描述的不是很准确,已经更新。这次不是按照age排序,而是按照一个分组函数排序,请问这种情况如何解决呢?
@yanwushu:
select t1.name from t1 X
left outer join
(select name, count(name) as NameCount from t2 group by name)Y
on X.name=y.name
order by y.NameCount
@爱编程的大叔: 谢谢你的回复,你的回答让我对表连接有了新的认识!