Query like
select email from users where email!=‘NULL’;
into local csv file
Query like
select email from users where email!=‘NULL’;
into local csv file
@Raja_Nukala I think the query you want looks like:
SELECT email FROM users WHERE email <> NULL;
Why do you want to export all users who have an email address to a CSV?
i want to send newsletters to all emails.
The easiest way to solve this task is to write an RPC function you can call with the HTTP key which will execute a custom SQL query that looks like:
SELECT json_agg(row) AS emails FROM (SELECT email FROM users WHERE email <> NULL OR email <> '') AS row;
The output of the query will look similar to:
emails
-----------------------------------------
[{"email":"abc@gmail.com"}, +
{"email":"xyz@yahoo.co.uk"}]
(1 row)
You can run this custom SQL within a small RPC function that would send the results back as a JSON object. Have a look at the server framework function reference for how to achieve it:
https://heroiclabs.com/docs/runtime-code-function-reference/#sql