根据字段去重查询所有数据
select distinct aa,* from TableInfo
where ID in (select MAX(ID) from TableInfogroup by aa)
select top 5 * from CH_PlanInfo left join CH_PlanTypeInfo on CH_PlanInfo.PlanTypeID=CH_PlanTypeInfo.PlanTypeID
where PlanID in (select MAX(PlanID) from CH_PlanInfo group by PlanCard)