postgres return values in one table but not in another

Madison Kelly linux-5ZoueyuiTZhBDgjK7y7TUQ at public.gmane.org
Mon Dec 27 16:31:35 UTC 2004


Hi all,

   I need to do something that I am sure is possible but I can't think 
of the words to even properly search Google for an answer on...

   I need to keep to tables in synch. There are three fields (UUID [a 
serial number for a partition], the parent directory and the actual file 
name) that are common between the two tables.

   The first table (say table A) geta updated based on external 
information. Once it is updated, I need to remove entries in table B 
that no longer have a matching entry in table A and then look for 
entries in table A that do not have a matching entry yet in table B and 
add them.

   Lance and I talked about this on the way into work and here is what 
we hashed out (though the syntax is the question):

- First I want to do a DELETE where ever an entry in table B has a given 
UUID (the partition serial number) without a matching parent directory 
and file name in table A. This purges stale info.

- Next I want to say SELECT the parent directory and file name from 
table A where a matching entry does not exist in table B. Then I will do 
a 'while' loop to do the processing I need and write out the missing data.

   So I guess to put it simply, how can I do a join that returns the 
value from one table when a match doesn't exit?

Thanks all! I hope everyone is having a relaxing holiday!

Madison
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list