SesarDB

Home Tables Schemas Diagrams Foreign Keys Indexes
wfs_samples - View
Name wfs_samples
SQL
SELECT
    s.igsn,
    s.name AS object_name,
    st.name AS object_type,
    st2.name AS object_class,
    (c2.name::text || '>'::text) || c1.name::text AS material,
    s.geom_latlong AS geom,
    s.field_name,
    'http:
FROM sample s LEFT
    JOIN sample_type st ON st.sample_type_id = s.sample_type_id LEFT
    JOIN sample_type st2 ON st2.sample_type_id = st.parent_sample_type_id LEFT
    JOIN classification c1 ON c1.classification_id = s.classification_id LEFT
    JOIN classification c2 ON c2.classification_id = s.top_level_classification_id
WHERE s.origin_sample_id IS NULL
        AND s.geom_latlong IS NOT NULL
        AND s.publish_date <= now()
        AND (s.archive_date >= now()
        OR s.archive_date IS NULL)
        AND NOT (s.igsn_prefix::text IN ( SELECT sesar_user_code.user_code
FROM sesar_user_code
WHERE (sesar_user_code.sesar_user_id IN ( SELECT sesar_user.sesar_user_id
FROM sesar_user
WHERE sesar_user.fname::text ~~ '%Kelsey%'::text
        AND sesar_user.lname::text ~~ '%Markey%'::text
        OR sesar_user.fname::text ~~ '%Megan%'::text
        AND sesar_user.lname::text ~~ '%Carter%'::text
        OR sesar_user.fname::text ~~ '%Lulin%'::text
        AND sesar_user.lname::text ~~ '%Song%'::text))))