This file contains hidden or 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 * | |
FROM "CVR_CAMPAIGN_DISCLOSURE_CD" a | |
JOIN "SMRY_CD" b | |
ON a."FILING_ID" = b."FILING_ID" | |
AND a."AMEND_ID" = b."AMEND_ID" | |
WHERE a."FORM_TYPE" = 'F460' | |
AND UPPER(b."FORM_TYPE") ~ '^[A-Z]$' | |
AND ("AMOUNT_B" > 0 OR "AMOUNT_C" > 0); |
This file contains hidden or 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 a."FILING_ID", a."AMEND_ID", COUNT(*) | |
FROM "SMRY_CD" a | |
LEFT JOIN "CVR_CAMPAIGN_DISCLOSURE_CD" b | |
ON a."FILING_ID" = b."FILING_ID" | |
AND a."AMEND_ID" = b."AMEND_ID" | |
WHERE b."FILING_ID" IS NULL | |
AND a."FORM_TYPE" IN ( | |
-- get the possible SMRY_CD form_type values for the F460 filings in CVR_CAMPAIGN_DISCLOSURE_CD | |
SELECT DISTINCT a."FORM_TYPE" | |
FROM "SMRY_CD" a |
This file contains hidden or 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 COUNT(DISTINCT "XREF_ID") | |
FROM "FILER_XREF_CD" | |
WHERE "XREF_ID" ~ '\D'; |
This file contains hidden or 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 table_name, filing_id_count | |
FROM ( | |
SELECT 'CVR2_CAMPAIGN_DISCLOSURE_CD' as table_name, COUNT(DISTINCT a."FILING_ID") as filing_id_count | |
FROM "CVR2_CAMPAIGN_DISCLOSURE_CD" a | |
LEFT JOIN "FILINGS_CD" b | |
ON a."FILING_ID" = b."FILING_ID" | |
WHERE b."FILING_ID" IS NULL | |
UNION | |
SELECT 'CVR2_LOBBY_DISCLOSURE_CD' as table_name, COUNT(DISTINCT a."FILING_ID") as filing_id_count | |
FROM "CVR2_LOBBY_DISCLOSURE_CD" a |
This file contains hidden or 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 COUNT(DISTINCT "FILING_ID") | |
FROM ( | |
SELECT "FILING_ID" | |
FROM "CVR2_CAMPAIGN_DISCLOSURE_CD" | |
UNION | |
SELECT "FILING_ID" | |
FROM "CVR2_LOBBY_DISCLOSURE_CD" | |
UNION | |
SELECT "FILING_ID" | |
FROM "CVR2_REGISTRATION_CD" |
This file contains hidden or 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 'CVR2_CAMPAIGN_DISCLOSURE_CD' as table_name, COUNT(DISTINCT "FILING_ID") as filing_id_count | |
FROM "CVR2_CAMPAIGN_DISCLOSURE_CD" | |
UNION | |
SELECT 'CVR2_LOBBY_DISCLOSURE_CD' as table_name, COUNT(DISTINCT "FILING_ID") as filing_id_count | |
FROM "CVR2_LOBBY_DISCLOSURE_CD" | |
UNION | |
SELECT 'CVR2_REGISTRATION_CD' as table_name, COUNT(DISTINCT "FILING_ID") as filing_id_count | |
FROM "CVR2_REGISTRATION_CD" | |
UNION | |
SELECT 'CVR2_SO_CD' as table_name, COUNT(DISTINCT "FILING_ID") as filing_id_count |
This file contains hidden or 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 COUNT(DISTINCT "FILING_ID") | |
FROM ( | |
SELECT "FILING_ID" | |
FROM "CVR2_CAMPAIGN_DISCLOSURE_CD" | |
UNION | |
SELECT "FILING_ID" | |
FROM "CVR2_LOBBY_DISCLOSURE_CD" | |
UNION | |
SELECT "FILING_ID" | |
FROM "CVR2_REGISTRATION_CD" |
This file contains hidden or 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 foo.table_name, cols.data_type, foo.filer_id_count | |
FROM ( | |
SELECT 'BALLOT_MEASURES_CD' as table_name, COUNT(DISTINCT a."FILER_ID") as filer_id_count | |
FROM "BALLOT_MEASURES_CD" a | |
LEFT JOIN "FILERS_CD" b | |
ON a."FILER_ID" = b."FILER_ID" | |
WHERE b."FILER_ID" IS NULL | |
UNION | |
SELECT 'CVR_CAMPAIGN_DISCLOSURE_CD' as table_name, COUNT(DISTINCT a."FILER_ID") as filer_id_count | |
FROM "CVR_CAMPAIGN_DISCLOSURE_CD" a |
This file contains hidden or 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 COUNT(*) | |
FROM ( | |
SELECT "FILER_ID"::varchar | |
FROM "FILER_XREF_CD" | |
UNION | |
SELECT "FILER_ID"::varchar | |
FROM "FILER_FILINGS_CD" | |
UNION | |
SELECT "FILER_ID"::varchar | |
FROM "FILERNAME_CD" |
This file contains hidden or 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 'BALLOT_MEASURES_CD' as table_name, COUNT(DISTINCT "FILER_ID"::varchar) as filer_id_count | |
FROM "BALLOT_MEASURES_CD" | |
UNION | |
SELECT 'CVR_CAMPAIGN_DISCLOSURE_CD' as table_name, COUNT(DISTINCT "FILER_ID") as filer_id_count | |
FROM "CVR_CAMPAIGN_DISCLOSURE_CD" | |
UNION | |
SELECT 'CVR_F470_CD' as table_name, COUNT(DISTINCT "FILER_ID") as filer_id_count | |
FROM "CVR_F470_CD" | |
UNION | |
SELECT 'CVR_LOBBY_DISCLOSURE_CD' as table_name, COUNT(DISTINCT "FILER_ID") as filer_id_count |