日期:2014-05-17 浏览次数:20571 次
select id, AreaNo, AreaName, max(ProvinceID), PostCode ,ZoneCode, Area ,AreaLevel, AddWho from tb where AddWho=13 group by
------解决方案--------------------
----写错了忘记加分组条件了。 select id, AreaNo, AreaName, max(ProvinceID), PostCode ,ZoneCode, Area ,AreaLevel, AddWho from tb where AddWho=13 group by id, AreaNo, AreaName, PostCode ,ZoneCode, Area ,AreaLevel, AddWho
------解决方案--------------------
---也可以这样写 select id, AreaNo, AreaName, ProvinceID, PostCode ,ZoneCode, Area ,AreaLevel, AddWho from tb where AddWho=13 group by id, AreaNo, AreaName, PostCode ,ZoneCode, Area ,AreaLevel, AddWho having max(provinceID)
------解决方案--------------------
select * from td a where AddWho=13 and id=(select min(id) from td where AddWho=13 and ProvinceID=(select max(ProvinceID) from td where AddWho=13))