<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
<p class="MsoNormal">Hi All,<u1:p></u1:p><o:p></o:p></p><p class="MsoNormal"><br></p>

<p class="MsoNormal">I have a table hydro_net in PostGIS database. The table has
following schema:<u1:p></u1:p><o:p></o:p></p>

<p class="MsoNormal"><o:p> </o:p></p>

<p class="MsoNormal" style="margin-left:1.0in">CREATE TABLE public.hydro_net<u1:p></u1:p><o:p></o:p></p>

<p class="MsoNormal" style="margin-left:1.0in">(hid integer NOT NULL DEFAULT
nextval,<u1:p></u1:p><o:p></o:p></p>

<p class="MsoNormal" style="margin-left:1.0in"><span style="mso-spacerun:yes"> 
</span>f_code_des varchar(254),<u1:p></u1:p><o:p></o:p></p>

<p class="MsoNormal" style="margin-left:1.0in"><span style="mso-spacerun:yes"> 
</span>hyd_desc varchar(254),<u1:p></u1:p><o:p></o:p></p>

<p class="MsoNormal" style="margin-left:1.0in"><span style="mso-spacerun:yes"> 
</span>hyd_name varchar(254),<o:p></o:p></p>

<p class="MsoNormal" style="margin-left:1.0in"><span style="mso-spacerun:yes"> 
</span>geom geometry, <u1:p></u1:p><o:p></o:p></p>

<p class="MsoNormal"><u1:p> </u1:p><o:p></o:p></p>

<p class="MsoNormal">I have more than 3000 records in this table and some records
have multiple hyd_name but with the same geometry. I can count the hyd_name
with a simple query to get the hyd_name and the count as under:<u1:p></u1:p><o:p></o:p></p>

<p class="MsoNormal"><o:p> </o:p></p>

<p class="MsoNormal" style="margin-left:1.0in">select hyd_name, count(*)<u1:p></u1:p><o:p></o:p></p>

<p class="MsoNormal" style="margin-left:1.0in">from hydro_net<u1:p></u1:p><o:p></o:p></p>

<p class="MsoNormal" style="margin-left:1.0in">group by hyd_name<u1:p></u1:p><o:p></o:p></p>

<p class="MsoNormal" style="margin-left:1.0in">having count(*) > 1<u1:p></u1:p><o:p></o:p></p>

<p class="MsoNormal" style="margin-left:1.0in">order by hyd_name;<u1:p></u1:p><o:p></o:p></p>

<p class="MsoNormal"><u1:p> </u1:p><o:p></o:p></p>

<p class="MsoNormal">I would like to know if it is possible to get the table out
all the columns in the original table with the records of duplicate hyd_name
and its count. <u1:p></u1:p><o:p></o:p></p>

<p class="MsoNormal">I am not really getting how to write a query that count the
hyd_name and also returns all column information as well at least hyd_name,
geom and count.<o:p></o:p></p>

<p class="MsoNormal"><u1:p> </u1:p><o:p></o:p></p>

<p class="MsoNormal">Would really appreciate any help.<u1:p></u1:p><o:p></o:p></p>

<p class="MsoNormal"><u1:p> </u1:p><o:p></o:p></p>

<p class="MsoNormal">Thanks,<u1:p></u1:p><o:p></o:p></p>

<p class="MsoNormal">Yamini<u1:p></u1:p><o:p></o:p></p>                                     </body>
</html>