Revision 12643
Added by Aaron Marcuse-Kubitza over 10 years ago
vegbien.sql | ||
---|---|---|
7503 | 7503 |
JOIN public.locationevent USING (plot_id)) |
7504 | 7504 |
LEFT JOIN public.project USING (project_id)) |
7505 | 7505 |
WHERE ((plot.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname)) AND (EXISTS ( SELECT NULL::unknown AS unknown |
7506 |
FROM (((((public.location |
|
7507 |
JOIN public.locationevent locationevent_1 USING (location_id)) |
|
7506 |
FROM ((((public.locationevent locationevent_1 |
|
7508 | 7507 |
JOIN public.taxonoccurrence USING (locationevent_id)) |
7509 | 7508 |
JOIN public.aggregateoccurrence USING (taxonoccurrence_id)) |
7510 | 7509 |
JOIN public.plantobservation USING (aggregateoccurrence_id)) |
7511 | 7510 |
JOIN public.stemobservation USING (plantobservation_id)) |
7512 |
WHERE ((location.plot_location_id = plot.plot_id) AND ((stemobservation.sourceaccessioncode IS NOT NULL) OR (stemobservation.authorstemcode IS NOT NULL)))
|
|
7511 |
WHERE ((locationevent_1.plot_id = plot.plot_id) AND ((stemobservation.sourceaccessioncode IS NOT NULL) OR (stemobservation.authorstemcode IS NOT NULL)))
|
|
7513 | 7512 |
LIMIT 1))) |
7514 | 7513 |
ORDER BY plot.authorlocationcode; |
7515 | 7514 |
|
... | ... | |
7544 | 7543 |
JOIN public.locationevent USING (plot_id)) |
7545 | 7544 |
LEFT JOIN public.project USING (project_id)) |
7546 | 7545 |
WHERE ((plot.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname)) AND (EXISTS ( SELECT NULL::unknown AS unknown |
7547 |
FROM (((public.location |
|
7548 |
JOIN public.locationevent locationevent_1 USING (location_id)) |
|
7546 |
FROM ((public.locationevent locationevent_1 |
|
7549 | 7547 |
JOIN public.taxonoccurrence USING (locationevent_id)) |
7550 | 7548 |
JOIN public.aggregateoccurrence USING (taxonoccurrence_id)) |
7551 |
WHERE ((location.plot_location_id = plot.plot_id) AND (aggregateoccurrence.count > 1))
|
|
7549 |
WHERE ((locationevent_1.plot_id = plot.plot_id) AND (aggregateoccurrence.count > 1))
|
|
7552 | 7550 |
LIMIT 1))) |
7553 | 7551 |
ORDER BY plot.authorlocationcode; |
7554 | 7552 |
|
... | ... | |
7564 | 7562 |
JOIN public.locationevent USING (plot_id)) |
7565 | 7563 |
LEFT JOIN public.project USING (project_id)) |
7566 | 7564 |
WHERE ((plot.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname)) AND (EXISTS ( SELECT NULL::unknown AS unknown |
7567 |
FROM (((public.location |
|
7568 |
JOIN public.locationevent locationevent_1 USING (location_id)) |
|
7565 |
FROM ((public.locationevent locationevent_1 |
|
7569 | 7566 |
JOIN public.taxonoccurrence USING (locationevent_id)) |
7570 | 7567 |
JOIN public.aggregateoccurrence USING (taxonoccurrence_id)) |
7571 |
WHERE ((location.plot_location_id = plot.plot_id) AND (aggregateoccurrence.cover_fraction IS NOT NULL))
|
|
7568 |
WHERE ((locationevent_1.plot_id = plot.plot_id) AND (aggregateoccurrence.cover_fraction IS NOT NULL))
|
|
7572 | 7569 |
LIMIT 1))) |
7573 | 7570 |
ORDER BY plot.authorlocationcode; |
7574 | 7571 |
|
Also available in: Unified diff
schemas/vegbien.sql: public_validations: queries that use EXISTS: join locationevent.plot_id to plot.plot_id directly instead of going via location.plot_location_id