Changes

Jump to: navigation, search

Check Link Table Approval State NEW

523 bytes added, 00:07, 18 April 2017
no edit summary
# update_type, should be NULL
This query identifies which rows to update. I put them in a temporary table ''new_link_loc''. Note in this example I use Min("public".link.data_entry_date) which was the best option in South Sudan.
<pre>
SELECT
</pre>
=== UPDATE other than Location example ===__NOEDITSECTION__ Note in this example I use Min("public".fieldreport.dateofreport) which was the best option in South Sudan (third option would be hazardinfoversion.dataentrydate).
<pre>
UPDATE link
"public".hazardinfoversion
INNER JOIN "public".hazard ON "public".hazardinfoversion.hazard_guid = "public".hazard.hazard_guid
INNER JOIN "public".fieldreport ON "public".hazardinfoversion.fieldreport_guid = "public".fieldreport.fieldreport_guid
WHERE
"public".hazardinfoversion.hazardinfoversion_guid = "public".link.from_guid AND
(hazardinfoversion.hazard_guid, hazardinfoversion"public".dataentrydatefieldreport.dateofreport) IN ((SELECT
"public".hazard.hazard_guid AS guid,
Min("public".hazardinfoversionfieldreport.dataentrydatedateofreport)
FROM
"public".hazard
INNER JOIN "public".hazardinfoversion ON "public".hazardinfoversion.hazard_guid = "public".hazard.hazard_guid
INNER JOIN "public".link ON "public".link.from_guid = "public".hazardinfoversion.hazardinfoversion_guid
INNER JOIN "public".fieldreport ON "public".fieldreport.fieldreport_guid = "public".hazardinfoversion.fieldreport_guid
WHERE
"public".hazardinfoversion.link_only = 'f' AND
from link
where approval_state = 'NEW'
and link.from_guid = hazardinfoversion.hazardinfoversion_guid) )
GROUP BY
"public".hazard.hazard_guid))
6,632
edits

Navigation menu