<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><BR><DIV><DIV>On Feb 14, 2007, at 6:20 AM, Obe, Regina wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV style="text-align: -khtml-left; "><FONT face="Arial" color="#0000ff" size="2"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">SELECT w.obs_id,  sites.station_id, sites.longname, sites.lat, sites.lon, sites.thepoint_meter,</SPAN></FONT></DIV><DIV style="text-align: -khtml-left; "><FONT face="Arial" color="#0000ff" size="2"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">w.date, w.year, w.month, w.day, w.doy, w.precip, w.tmin, w.tmax, w.tmean, w.snowfall, w.snowdepth,</SPAN></FONT></DIV><DIV style="text-align: -khtml-left; "><FONT face="Arial" color="#0000ff" size="2"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">s.date, s.year, s.month, s.day, s.doy, s.rad, s.dss, s.par</SPAN></FONT></DIV><DIV style="text-align: -khtml-left; "><FONT face="Arial" color="#0000ff" size="2"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">FROM sites </SPAN><SPAN class="752473911-14022007"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">INNER JOIN solar s ON sites.station_id = s.station_id </SPAN></SPAN><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">LEFT OUTER JOIN weather w </SPAN><SPAN class="752473911-14022007"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">ON w.station_id = sites.station_id</SPAN></SPAN></FONT></DIV><DIV style="text-align: -khtml-left; "><SPAN class="752473911-14022007"><FONT face="Arial" color="#0000ff" size="2"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">UNION</SPAN></FONT></SPAN></DIV><DIV style="text-align: -khtml-left; "><SPAN class="752473911-14022007"><SPAN class="Apple-style-span" style="text-align: -khtml-left; "></SPAN><DIV style="text-align: -khtml-left; "><FONT face="Arial" color="#0000ff" size="2"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">SELECT w.obs_id,  sites.station_id, sites.longname, sites.lat, sites.lon, sites.thepoint_meter,</SPAN></FONT></DIV><DIV style="text-align: -khtml-left; "><FONT face="Arial" color="#0000ff" size="2"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">w.date, w.year, w.month, w.day, w.doy, w.precip, w.tmin, w.tmax, w.tmean, w.snowfall, w.snowdepth,</SPAN></FONT></DIV><DIV style="text-align: -khtml-left; "><FONT face="Arial" color="#0000ff" size="2"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">s.date, s.year, s.month, s.day, s.doy, s.rad, s.dss, s.par</SPAN></FONT></DIV><DIV style="text-align: -khtml-left; "><FONT color="#0000ff"><FONT face="Arial"><FONT size="2"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">FROM sites </SPAN><SPAN class="752473911-14022007"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">INNER</SPAN></SPAN></FONT></FONT><SPAN class="752473911-14022007"><FONT face="Arial"><FONT size="2"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; "> JOIN </SPAN><FONT color="#000000"><SPAN class="Apple-style-span" style="font-family: Arial; font-size: 10px; text-align: -khtml-left; "></SPAN></FONT></FONT></FONT><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); text-align: -khtml-left; "></SPAN><DIV dir="ltr"><FONT face="Arial" size="2"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">(SELECT </SPAN><SPAN class="752473911-14022007"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">s2.</SPAN></SPAN><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">station_id, min(distance(s</SPAN><SPAN class="752473911-14022007"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">2</SPAN></SPAN><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">.thepoint_meter, sol.thepoint_meter))  As mindist</SPAN></FONT></DIV><DIV dir="ltr"><FONT face="Arial"><FONT size="2"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">FROM station s</SPAN><SPAN class="752473911-14022007"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">2</SPAN></SPAN><SPAN class="752473911-14022007"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; "> LEFT JOIN solar nosols ON s2.station_id = nosols.station_id</SPAN></SPAN><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; "> </SPAN><SPAN class="752473911-14022007"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">CROSS JOIN vwsolar sol</SPAN></SPAN></FONT></FONT></DIV></SPAN></FONT></DIV></SPAN></DIV></SPAN></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Regina, did you mean FROM sites s2 LEFT JOIN here? There is no "station" table, nor have we aliased one</DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR><BLOCKQUOTE type="cite"><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV style="text-align: -khtml-left; "><SPAN class="752473911-14022007"><DIV style="text-align: -khtml-left; "><FONT color="#0000ff"><SPAN class="752473911-14022007"><DIV dir="ltr"><FONT face="Arial"><FONT size="2"><SPAN class="752473911-14022007"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">WHERE nosols.station_id IS NULL</SPAN></SPAN></FONT></FONT></DIV><DIV dir="ltr"><FONT face="Arial"><FONT size="2"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">GROUP BY s</SPAN><SPAN class="752473911-14022007"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">2</SPAN></SPAN><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">.station_id) </SPAN><SPAN class="752473911-14022007"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">solmin</SPAN></SPAN></FONT></FONT></DIV></SPAN></FONT></DIV><DIV style="text-align: -khtml-left; "><FONT face="Arial" color="#0000ff" size="2"><SPAN class="752473911-14022007"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">    ON sites.station_id = solmin.station_id INNER JOIN vwsolar s ON distance(sites.thepoint_meter, s.thepoint_meter) = solmin.mindistance </SPAN></SPAN><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">LEFT JOIN weather w </SPAN><SPAN class="752473911-14022007"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">ON w.station_id = sites.station_id</SPAN></SPAN><SPAN class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Arial; font-size: 10px; text-align: -khtml-left; ">)</SPAN></FONT></DIV></SPAN></DIV></SPAN></BLOCKQUOTE></DIV><BR></BODY></HTML>