Hi all,

This is my first post here so please let me know if I miss any list guidelines. :)

I was hoping to get some help, advice or pointers to an answer for a somewhat odd (to me at least) SELECT. What I am trying to do is select that values from one table where matching values do not exist in another table.

For example:

Let's say 'table_a' has the columns 'a_name, a_type, a_dir, a_<others>' and 'table_b' has the columns 'b_name, b_type, b_dir, b_<others>' where 'others' are columns unique to each table. What I need to do is select all the values in 'a_name, a_type, a_dir' from 'table_a' where there is no matching entries in "table_b's" 'b_name, b_type, b_dir'.

  I know I could do something like:

SELECT a_name, a_type, a_dir FROM table_a;

and then loop through all the returned values and for each do a matching select from 'table_b' and use my program to catch the ones not in 'table_b'. This is not very efficient though and I will be searching through tables that could have several hundred thousand entries so the inefficiency would be amplified. Is there some way to use a join or something similar to do this?

  Thank you all!

Madison

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Reply via email to