Created
March 24, 2014 13:47
-
-
Save benizar/9740379 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT *, true AS resid FROM usos5 WHERE usos5.id_2009 IN (SELECT id_2009 FROM usos5 | |
WHERE (xpath('//COBERTURA[@ID="EDF" and @Sup>20]/@ID', xml_2009::xml))[1]::text='EDF' | |
OR (xpath('//COBERTURA[@ID="UCS" and @Sup>20]/@ID', xml_2009::xml))[1]::text='UCS' | |
OR (xpath('//COBERTURA[@ID="UEN" and @Sup>20]/@ID', xml_2009::xml))[1]::text='UEN' | |
OR (xpath('//COBERTURA[@ID="UDS" and @Sup>20]/@ID', xml_2009::xml))[1]::text='UDS' | |
OR (xpath('//COBERTURA[@ID="TCO" and @Sup>20]/@ID', xml_2009::xml))[1]::text='TCO' | |
OR (xpath('//COBERTURA[@ID="TCH" and @Sup>20]/@ID', xml_2009::xml))[1]::text='TCH') | |
UNION | |
SELECT *, false AS resid FROM usos5 WHERE usos5.id_2009 NOT IN (SELECT id_2009 FROM usos5 | |
WHERE (xpath('//COBERTURA[@ID="EDF" and @Sup>20]/@ID', xml_2009::xml))[1]::text='EDF' | |
OR (xpath('//COBERTURA[@ID="UCS" and @Sup>20]/@ID', xml_2009::xml))[1]::text='UCS' | |
OR (xpath('//COBERTURA[@ID="UEN" and @Sup>20]/@ID', xml_2009::xml))[1]::text='UEN' | |
OR (xpath('//COBERTURA[@ID="UDS" and @Sup>20]/@ID', xml_2009::xml))[1]::text='UDS' | |
OR (xpath('//COBERTURA[@ID="TCO" and @Sup>20]/@ID', xml_2009::xml))[1]::text='TCO' | |
OR (xpath('//COBERTURA[@ID="TCH" and @Sup>20]/@ID', xml_2009::xml))[1]::text='TCH') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment