日期:2014-05-18  浏览次数:20674 次

一条ORACLE 的SQL语句关于group by 的
select  rownum, 'ckqy5' as layer, 'Default' as tag, 'POLYGON' as type, c.smid, c.name as title, c.examincode, x.roadnames as road from 交叉点 x left join ckqy5 c on  x.ckqy5id = c.examincode where c.examincode like'%%' and x.roadnames like '%%,%%' and rownum <= 10 group by();想要得到的结果是如果title,examincode, road这三个字段全部相同的话只显示其中一条

------解决方案--------------------
先根据这三个字段分组,这样就去除重复了,然后再加上固定的字段值