Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save CatEntangler/347557f51ae49532ca9546cc669e77c6 to your computer and use it in GitHub Desktop.
Save CatEntangler/347557f51ae49532ca9546cc669e77c6 to your computer and use it in GitHub Desktop.
SELECT main.lead_id
FROM wp_rg_lead_detail as main
WHERE main.form_id = 1
AND main.lead_id NOT IN (
SELECT wp_rg_lead_detail.lead_id
FROM wp_rg_lead_detail
WHERE wp_rg_lead_detail.form_id = 1
AND wp_rg_lead_detail.field_number = 102
AND wp_rg_lead_detail.value <> ''
)
GROUP BY main.lead_id
ORDER BY main.lead_id ASC
@CatEntangler
Copy link
Author

Needed to get a list of leads from gravity forms tables that either didn't have a value or didn't have a row with the field_number 102

Using GFAPI::get_entries isn't documented at all and trial and error was taking too long.

This worked.

replace form_id and field_number with whatever.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment