Kalfja
Kalfja

Reputation: 63

SQL exclude query

Can anyone help me with this query?

select name as d, test_run_id as r, folder_id as f From test_run;

This query yields me the values I would like to exclude from the top query:

 select folder_id from folder where name in (select column_value from table (apex_string.split(config.get('ATM_DASHBOARD_CONFIGURATION_FOLDER_EXCLUDE'), ','))); 

Can anyone help me combine them? I need to exclude results from the second query in the first one.

This was one of my many tries:

select name as d, test_run_id as r, folder_id as f From test_run 
EXCEPT
(select folder_id as f  from folder where name in (select column_value from table  (apex_string.split(config.get('ATM_DASHBOARD_CONFIGURATION_FOLDER_EXCLUDE'), ','))));

Many thanks

Upvotes: 0

Views: 346

Answers (2)

try using where not exists

  select * from table_a a
   where not exists
       ( select '' from table_b b where b.name=a.name 

Upvotes: 0

Brian
Brian

Reputation: 8616

Have you tried, something like:

SELECT name as d, test_run_id as r, folder_id as f
FROM test_run 
WHERE f not in(select folder_id as f from folder where name in (select column_value from table  (apex_string.split(config.get('ATM_DASHBOARD_CONFIGURATION_FOLDER_EXCLUDE'), ','))));

Upvotes: 2

Related Questions