agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
From: Daryl Sayers <daryl@stone.oz.au>
To: postgres@postgres.Berkeley.EDU
Date: Mon, 6 Nov 95 10:41:44 AEST
Message-ID: <9511061041.aa16227@odtdev.stone.oz.au> (raw)

Newsgroups: stone.mlist.postgres
Path: daryl
From: daryl@stone.oz.au (Daryl Sayers)
Subject: Re: Simple retrieve question
Organization: Stone Microsystems, NSW, Australia
Date: Mon, 6 Nov 1995 00:41:37 GMT
Message-ID: <DHLJ9D.CI9@stone.oz.au>
X-Newsreader: NN version 6.5.0 #3
References: <9511031223.aa22499@odtdev.stone.oz.au>

>O.K. call me lame, but I can't figure it out.....

>I have 2 classes, One for Company info and 1 for Contacts.
>For every Contact record there is an id that points to the
>Company it belongs to. My questions how can I retrieve all
>the Companys that do not have a Contact record.

O.K. Here is some more information as the kind souls that answered
me all suggested similar ideas that I had already tried.

retrieve (u.name)
	from u in company, v in contact 
	where u.id != v.id

This doesnt work because it goes through all the Companys and checks against
all Contacts.

example:
Class Company			Class Contacts
id	Company			id	Contact
1	AAAA			1	Fred Dag
2	BBBB			1	Joe Bloggs
3	CCCC			3	Pete Smith

The command above will produce a list:
(u.id != v.id)
( 1   != 1   ) Dont Print AAAA
(u.id != v.id)
( 2   != 1   ) **** Print BBBB      BBBB
(u.id != v.id)
( 3   != 1   ) **** Print CCCC      CCCC
(u.id != v.id)
( 1   != 1   ) Dont Print AAAA
(u.id != v.id)
( 2   != 1   ) **** Print BBBB      BBBB
(u.id != v.id)
( 3   != 1   ) **** Print CCCC      CCCC
(u.id != v.id)
( 1   != 3   ) **** Print AAAA      AAAA
(u.id != v.id)
( 2   != 3   ) **** Print BBBB      BBBB
(u.id != v.id)
( 3   != 3   ) Dont Print CCCC

I am using postgres4.2
-- 
Daryl Sayers                              Ph: (02) 417 3788
Stone Group Asia Pacific                 Fax: (02) 417 3741
Unit 20, 380 Eastern Valley Way        Email: daryl@stone.oz.au
Roseville, 2069 NSW Australia            WWW: http://sydney.DIALix.com/~stone

==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU".
   If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================
              URL: http://s2k-ftp.CS.Berkeley.EDU:8000/postgres/



reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: postgres@postgres.berkeley.edu
  Cc: daryl@stone.oz.au
  Subject: Re: 
  In-Reply-To: <9511061041.aa16227@odtdev.stone.oz.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox