Project

General

Profile

« Previous | Next » 

Revision 12679

inputs/SALVIAS/validations.sql: implemented _plots_19_count_of_censuses_per_plot_in_each_project

View differences:

trunk/inputs/SALVIAS/validations.sql
375 375

  
376 376

  
377 377
--
378
-- Name: _plots_19_count_of_censuses_per_plot_in_each_project; Type: VIEW; Schema: SALVIAS; Owner: -
379
--
380

  
381
CREATE VIEW _plots_19_count_of_censuses_per_plot_in_each_project AS
382
 SELECT p.project_name, 
383
    (pm."SiteCode")::text AS plot_code, 
384
    count(DISTINCT ARRAY[po.census_date]) AS inventories
385
   FROM ((projects p
386
   JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id)))
387
   LEFT JOIN "plotObservations" po ON (((pm."PlotID" = po."PlotID") AND ((pm."SiteCode")::text IS NOT NULL))))
388
  GROUP BY p.project_name, (pm."SiteCode")::text
389
  ORDER BY p.project_name, (pm."SiteCode")::text;
390

  
391

  
392
--
378 393
-- PostgreSQL database dump complete
379 394
--
380 395

  

Also available in: Unified diff