select name, max(menbername) as menberName, min(menbername) as menberName,from familygroup by name
使用When then语句即可实现。我给你找个案例吧http://zhidao.baidu.com/question/542451155.html