I have a table contains customer details and i need to exclude certain emails from specific domains(identified from email string) from my table. How can i do that?
Tried with below but is not working any idea or suggestions ?
PostgreSQL Version 11
WITH CTE AS
(
select 'gmail.com' as name
union
select 'yahoo.com'
)
,base as
(
SELECT 'email ILIKE ''%'||name||'%''OR' as emails FROM CTE
)
,finals as
(
SELECT string_agg(emails, ' ') as con FROM base
)
SELECT * FROm customers
WHERE (SELECT con FROM finals )
Error i'm getting,
ERROR: argument of WHERE must be type boolean, not type text
LINE 16: WHERE (SELECT con FROM finals )
^
SQL state: 42804
Character: 242