Re: [SQL] SQL Query help needed - newbie question

Поиск
Список
Период
Сортировка
От Chris Bitmead
Тема Re: [SQL] SQL Query help needed - newbie question
Дата
Msg-id 38990833.49C7E70D@nimrod.itg.telecom.com.au
обсуждение исходный текст
Ответ на SQL Query help needed - newbie question  (Scott Chapman <sec@proaxis.com>)
Список 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
> 
> ************


В списке pgsql-sql по дате отправления:

Предыдущее
От: Scott Chapman
Дата:
Сообщение: SQL Query help needed - newbie question
Следующее
От: Don Baccus
Дата:
Сообщение: Re: [HACKERS] Re: [SQL] Proposed Changes to PostgreSQL