<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><BR><DIV><DIV>On Feb 13, 2007, at 5:01 PM, Obe, Regina wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">SELECT station_id, distance(s.thepoint_meter, sol.thepoint_meter)<SPAN class="Apple-converted-space">  </SPAN>As dist</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">FROM station s, solar sol</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">(you are right I'm aliasing station s and sol for solar and I made the possibly incorrect assumption that you have a thepoint_meter in your solar table.<SPAN class="Apple-converted-space">  </SPAN>If you don't you'd have to do another alias join with station to get the point location.).</FONT></P> </BLOCKQUOTE></DIV><BR><DIV>I'm still struggling with this part Regina. thepoint_meter is not in the solar table. geometry is in the sites table only (there is no station table, station_id is a column name). So I will need to do a third join (sites on solar). If I follow you correctly.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I have simplified my select with aliases (so it's shorter), removed the nextval bit, and now have:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>SELECT w.obs_id,  sites.station_id, sites.longname, sites.lat, sites.lon, sites.thepoint_meter, </DIV><DIV>w.date, w.year, w.month, w.day, w.doy, w.precip, w.tmin, w.tmax, w.tmean, w.snowfall, w.snowdepth, </DIV><DIV>s.date, s.year, s.month, s.day, s.doy, s.rad, s.dss, s.par</DIV><DIV>FROM (sites LEFT OUTER JOIN weather w USING (station_id)) </DIV><DIV>FULL OUTER JOIN solar s USING (obs_id) </DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>However, I am confused on part where I need to do an alias join of the sites.thepoint_meter with solar. I think what I need is these three joins. (I was getting lost in all the parentheses):</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>FROM sites LEFT OUTER JOIN weather w USING (station_id)</DIV><DIV>FROM sites LEFT OUTER JOIN solar s USING (station_id)</DIV><DIV>FROM w FULL OUTER JOIN s USING (obs_id)</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Sorry for making this such a struggle. </DIV></BODY></HTML>