pg.ddx.io pgsql-sql@postgresql.org mailing list archivehelp / color / mirror / Atom feed
SQL Query help needed - newbie question 2+ messages / 2 participants [nested] [flat]
* SQL Query help needed - newbie question @ 2000-02-03 04:30 Scott Chapman <sec@proaxis.com> 0 siblings, 1 reply; 2+ messages in thread From: Scott Chapman @ 2000-02-03 04:30 UTC (permalink / raw) To: pgsql-sql 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. 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 ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [SQL] SQL Query help needed - newbie question @ 2000-02-03 04:46 Chris Bitmead <chrisb@nimrod.itg.telstra.com.au> parent: Scott Chapman <sec@proaxis.com> 0 siblings, 0 replies; 2+ messages in thread From: Chris Bitmead @ 2000-02-03 04:46 UTC (permalink / raw) To: sec@proaxis.com; +Cc: pgsql-sql 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 > > ************ ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2000-02-03 04:46 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2000-02-03 04:30 SQL Query help needed - newbie question Scott Chapman <sec@proaxis.com> 2000-02-03 04:46 ` Chris Bitmead <chrisb@nimrod.itg.telstra.com.au>
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