oracle如何使用限制计算重复值

时间:2016-02-26 02:43:36

标签: sql oracle

river country province
a1        b1        c1    
a1        b1        c2

select river, count(province)
from geo_river
group by river
having count (province) > 10
像这样,我知道怎么算河流十多省,但我不知道

如何统计河流跨越同一国家的10多个省份。

我需要添加一些限制,但不知道从哪里开始。

1 个答案:

答案 0 :(得分:0)

您只需更改 <?php $YearNow=Date('Y'); $dsds=$rowasa['posid']; $results = $db->prepare("SELECT * FROM candidates,student,school_year,partylist where student.idno = candidates.idno AND school_year.syearid = candidates.syearid AND posid =:a AND candidates.partyid = partylist.partyid AND school_year.from_year like $YearNow "); $results->bindParam(':a', $dsds); $results->execute(); for($i=0; $rows = $results->fetch(); $i++){ ?> //here's the part that i was confuse <input type ="radio"><input style="padding: 35px 50px 35px 80px; background:url('admin/candidates/images/<?php echo $rows['image']; ?>') no-repeat scroll 5px 7px / 70px auto rgba(0, 0, 0, 0);" value="<?php echo $rows['candid'] . "-" ."&nbsp". $rows['lastname'] .",". "&nbsp". $rows['firstname'] ?>"><?php echo $rows['lastname'] ?>, <?php echo $rows['firstname'] ?> - <?php echo $rows['party_name']?> <?php } ?>

即可
group by

也可以在select river, count(province) from geo_river group by river, country having count(province) > 10; 条款中包含country