Skip to content

Instantly share code, notes, and snippets.

@ssaid
Created August 21, 2015 15:08
Show Gist options
  • Save ssaid/fc76b99b1352c05de69d to your computer and use it in GitHub Desktop.
Save ssaid/fc76b99b1352c05de69d to your computer and use it in GitHub Desktop.
Query to export to CSV
```
COPY(SELECT rp.name AS Partner, rpa.name as Contact_Name, rpa.street, rpa.street2, rpa.city, rpa.zip, rcs.name as state, rc.name as country FROM res_partner_address rpa
JOIN res_partner rp ON rpa.partner_id=rp.id
JOIN res_country rc ON rpa.country_id=rc.id
JOIN res_country_state rcs ON rpa.state_id=rcs.id
WHERE rpa.type IS NULL AND rpa.active IS True
ORDER BY rp.name)
TO '/tmp/res_partner_address_type_null.csv' DELIMITER ',' CSV HEADER;
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment