<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none"><!--P{margin-top:0;margin-bottom:0;} .ms-cui-menu {background-color:#ffffff;border:1px rgb(171, 171, 171) solid;font-family:"Segoe UI WPC","Segoe UI",Tahoma,"Microsoft Sans Serif",Verdana,sans-serif;font-size:10pt;color:rgb(51, 51, 51);} .ms-cui-menusection-title {display:none;} .ms-cui-ctl {vertical-align:text-top;text-decoration:none;color:rgb(51, 51, 51);} .ms-cui-ctl-on {background-color:rgb(223, 237, 250);opacity: 0.8;} .ms-cui-img-cont-float {display:inline-block;margin-top:2px} .ms-cui-smenu-inner {padding-top:0px;} .ms-owa-paste-option-icon {margin: 2px 4px 0px 4px;vertical-align:sub;padding-bottom: 2px;display:inline-block;} .ms-rtePasteFlyout-option:hover {background-color:rgb(223, 237, 250) !important;opacity:1 !important;} .ms-rtePasteFlyout-option {padding:8px 4px 8px 4px;outline:none;} .ms-cui-menusection {float:left; width:85px;height:24px;overflow:hidden}
<!--
p
        {margin-top:0;
        margin-bottom:0}
.ms-cui-menu
        {background-color:#ffffff;
        border:1px rgb(171,171,171) solid;
        font-family:"Segoe UI WPC","Segoe UI",Tahoma,"Microsoft Sans Serif",Verdana,sans-serif;
        font-size:10pt;
        color:rgb(51,51,51)}
.ms-cui-menusection-title
        {}
.ms-cui-ctl
        {vertical-align:text-top;
        text-decoration:none;
        color:rgb(51,51,51)}
.ms-cui-ctl-on
        {background-color:rgb(223,237,250)}
.ms-cui-img-cont-float
        {display:inline-block;
        margin-top:2px}
.ms-cui-smenu-inner
        {padding-top:0px}
.ms-owa-paste-option-icon
        {margin:2px 4px 0px 4px;
        vertical-align:sub;
        padding-bottom:2px;
        display:inline-block}
.ms-rtePasteFlyout-option
        {padding:8px 4px 8px 4px;
        outline:none}
.ms-cui-menusection
        {float:left;
        width:85px;
        height:24px;
        overflow:hidden}
p
        {margin-top:0;
        margin-bottom:0}
-->
--></style>
</head>
<body>
<div style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<style type="text/css">
<!--
p
        {margin-top:0;
        margin-bottom:0}
.ms-cui-menu
        {background-color:#ffffff;
        border:1px rgb(171,171,171) solid;
        font-family:"Segoe UI WPC","Segoe UI",Tahoma,"Microsoft Sans Serif",Verdana,sans-serif;
        font-size:10pt;
        color:rgb(51,51,51)}
.ms-cui-menusection-title
        {}
.ms-cui-ctl
        {vertical-align:text-top;
        text-decoration:none;
        color:rgb(51,51,51)}
.ms-cui-ctl-on
        {background-color:rgb(223,237,250)}
.ms-cui-img-cont-float
        {display:inline-block;
        margin-top:2px}
.ms-cui-smenu-inner
        {padding-top:0px}
.ms-owa-paste-option-icon
        {margin:2px 4px 0px 4px;
        vertical-align:sub;
        padding-bottom:2px;
        display:inline-block}
.ms-rtePasteFlyout-option
        {padding:8px 4px 8px 4px;
        outline:none}
.ms-cui-menusection
        {float:left;
        width:85px;
        height:24px;
        overflow:hidden}
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div style="font-size: 12pt; color: #000000; background-color: #ffffff; font-family: calibri,arial,helvetica,sans-serif;">
<p>Hi,</p>
<p><br>
</p>
<p>If vname is unique in your table, why do you need to do "select distinct" on it?</p>
<p>I would make a blind guess with an alias name <font face="Courier New">select distinct on (<font color="FF0000">vname</font>)
<font color="FF0000">vname_distinct</font></font></p>
<p><br>
</p>
<p>Usually it is not as easy, though<br>
</p>
<p><br>
</p>
<p>-Jukka Rahkonen-<br>
</p>
<p><br>
</p>
<p> <br>
</p>
<div style="color: #282828;">
<hr tabindex="-1" style="display: inline-block; width: 98%;">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size: 11pt;">Basques, Bob wrote:</font>
<div> </div>
</div>
<div>
<div style="direction: ltr; font-family: tahoma; color: #000000; font-size: 10pt;">
> I'm trying to display a set of GPS points from a layer in Postrgres . . .<br>
<br>
> Getting this error however:<br>
<br>
<font face="Courier New"><ServiceExceptionReport version="1.3.0" xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wms/1.3.0/exceptions_1_3_0.xsd"><ServiceException><br>
msDrawMap(): Image handling error. Failed to draw layer named 'AVL_Plot_00to96'.<br>
msPostGISLayerWhichShapes(): Query error. Error executing query: ERROR:  column reference "vname" is ambiguous<br>
LINE 1: select "elapsed_min","vname",encode(ST_AsBinary(ST_Force2D("...<br>
 <br>
</ServiceException></ServiceExceptionReport></font><br>
<br>
from this Call:<br>
<br>
<font face="Courier New">DATA "the_geom from (<br>
<br>
                        select<br>
                                distinct on (<font color="FF0000">vname</font>) <font color="FF0000">
vname</font>,<br>
                                st_length(st_transform(the_line, 26993)) as feet,<br>
                                (DATE_PART('day', now() - acqtime) * 24 +<br>
                                        DATE_PART('hour', now() - acqtime) * 60 +<br>
                                        DATE_PART('minute', now() - acqtime)<br>
                                        ) as elapsed_min,  -- Compiled minutes since last major move of asset.<br>
                                *<br>
                        from<br>
                                <b>loc</b><br>
                        where<br>
                                st_length(st_transform(the_line, 26993)) > 30  -- GPS error<br>
                        order by <br>
                                <font color="FF0000">vname</font> desc <br>
<br>
                                        ) as subquery <b>using unique <font color="FF0000">
vname</font></b> using srid=200068"</font><br>
<br>
What I don't understand is how VNAME can be ambiguous when calling only one table (loc)??  The SQL works fine in PGADMIN.   Does the using unique vname have something to do with the problem, which seems to be required.<br>
<br>
Help??<br>
<br>
Thanks.<br>
<br>
bobb<br>
<br>
<br>
</div>
</div>
</div>
</div>
</div>
</body>
</html>