SQL for DWAF national chemical water quality monitoring project

Handles export from Water Management System output to ASCII list.
Author: Petro Schutte
unload to 'magda_94_00.unl' delimiter ','
select rr.mon_feature_id, sf.feature_name, 
       pl.point_latitude, pl.point_longitude, rr.primary_drain_code,
       rr.sample_no, rr.sample_begin_date, rr.sample_begin_time,
       rr.sample_end_date, rr.sample_end_time,
       rr.sample_begin_depth, rr.sample_end_depth,
       pr.preservative_abbr,mv.mon_variable_abbr,
       rr.result_num_value, rr.result_alpha_value
from released_result rr,
     spatial_feature sf,
     point_location pl,
     preservative pr,
     monitorng_variable mv
where rr.mon_feature_id = sf.feature_id
  and sf.point_location_id = pl.point_location_id
  and rr.preservative_id = pr.preservative_id
  and rr.mon_variable_id = mv.mon_variable_id
  and rr.sample_begin_date >= "1994-01-01"
  and rr.sample_begin_date <= "2000-12-31"
  and rr.mon_variable_id in (395,245,241,252)
order by rr.mon_feature_id, rr.sample_no

[IWQS Home]