pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris Bitmead <chrisb@nimrod.itg.telstra.com.au>
To: sec@proaxis.com
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] SQL Query help needed - newbie question
Date: Thu, 03 Feb 2000 15:46:43 +1100
Message-ID: <38990833.49C7E70D@nimrod.itg.telecom.com.au> (raw)
References: <00020220331102.00960@localhost.localdomain>

Scott Chapman wrote:
> 
> I am new to SQL and PostgreSQL and I'm not sure how to get this done in one
> query:
> 
> I have 3 tables:
> 
> Vendor
> ------
> VendorNumber
> EmailAddress
> .....
> 
> CrossReference
> --------------
> VendorNumber
> PartType
> SystemType
> 
> PartRequest
> --------
> RequestNumber
> PartType
> SystemType
> .....
> 
> I am processing the Parts Requests.
> 
> I need a query that returns the PartRequest.RequestNumber and
> Vendor.EmailAddress so I can send the Request to all Vendors that carry the
> requested PartType & SystemType combinations of parts.

SELECT RequestNumber, EmailAddress FROM PartRequest, Vendor,
CrossReference
WHERE Vendor.VendorNumber = CrossReference.VendorNumber AND
CrossReference.PartType = CrossReference.PartType AND
CrossReference.SystemType = PartRequest.SystemType;

> 
> So a given Request may be for a PartType of PrinterCable and SystemType of
> Macintosh.
> 
> The CrossReference table has a list of all vendors that carry PrinterCables for
> Macintoshes.
> 
> I am using PostgreSQL so I don't have foreign keys and I'm not sure enough of
> SQL yet to know if that's a problem.
> 
> Can someone here please help me with this query?
> Thanks!
> --
> Scott Chapman sends....
> sec@proaxis.com
> 
> ************



view thread (2+ messages)

Message-ID: <38990833.49C7E70D@nimrod.itg.telecom.com.au>
Permalink:  ../38990833.49C7E70D@nimrod.itg.telecom.com.au/
Also on:    postgresql.org/message-id/38990833.49C7E70D@nimrod.itg.telecom.com.au

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: chrisb@nimrod.itg.telstra.com.au, sec@proaxis.com
  Subject: Re: [SQL] SQL Query help needed - newbie question
  In-Reply-To: <38990833.49C7E70D@nimrod.itg.telecom.com.au>
  References: <00020220331102.00960@localhost.localdomain> <38990833.49C7E70D@nimrod.itg.telecom.com.au>

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

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