Referring to current_user email in SQL query

I have an SQL query in a Postgre database that unnests the project users id from the table projects and then joins it with the table users to identify their email. I want to restrict the results from the query in order to see only projects assigned to current_user by filtering through their email. I was wondering how to add the global variable current_user.email to the WHERE statement below?

SELECT users.id, projects.name, users.user_email FROM (SELECT projects.name, UNNEST(project_users) as user_id from projects ) projects INNER JOIN users ON projects.user_id = users.id WHERE users.user_email=

Thanks :slight_smile:

Use {{current_user.email }}
SELECT users.id, projects.name, users.user_email FROM (SELECT projects.name, UNNEST(project_users) as user_id from projects ) projects INNER JOIN users ON projects.user_id = users.id WHERE users.user_email={{current_user.email }}

Thanks @ScottR :slight_smile: