Board index » delphi » SQL outer left join question

SQL outer left join question

Hi

I have a main table, and i want to make some OUTER LEFT JOIN's at a time
with some other tables.
I know how to make this with 1 table, but not with many tables.
How cai i do this ? (i work with local sql)

Thanks (and sorry for my english)
Paco

 

Re:SQL outer left join question


From DBDEMOS :

select * from customer
left outer join orders on
customer.custno = orders.custno
left outer join items on
orders.orderno = items.orderno

Keep in mind that a left outer join will retreive all customers in the
customer table, whether they have orders or not, and so on for other tables
joined in the same way. Take a look at all types of joins (full, inner, left
outer and right outer) to decide which one you need.

--

Alain Quesnel
cinqsanss...@compuserve.com

-----

Quote
Paco Ruiz <7556705787#fcor...@bbvnet.com> wrote in message

news:38CAA77A.7FB998BC@bbvnet.com...
Quote
> Hi

> I have a main table, and i want to make some OUTER LEFT JOIN's at a time
> with some other tables.
> I know how to make this with 1 table, but not with many tables.
> How cai i do this ? (i work with local sql)

> Thanks (and sorry for my english)
> Paco

Re:SQL outer left join question


On Sat, 11 Mar 2000 21:07:22 +0100, Paco Ruiz

Quote
<7556705787#fcor...@bbvnet.com> wrote:
>I have a main table, and i want to make some OUTER LEFT JOIN's at a time
>with some other tables.
>I know how to make this with 1 table, but not with many tables.
>How cai i do this ? (i work with local sql)

Here is an example of a local SQL statement using LEFT OUTER joins to
join six of the sample Paradox tables.

  SELECT C.CustNo, O.OrderNo, I.PartNo, P.Description, V.VendorName,
    E.LastName || ", " || E.FirstName AS Agent
  FROM "Customer.db" C
    LEFT OUTER JOIN "Orders.db" O
      ON (C.CustNo = O.CustNo)
    LEFT OUTER JOIN "Items.db" I
      ON (O.OrderNo = I.OrderNo)
    LEFT OUTER JOIN "Parts.db" P
      ON (I.PartNo = P.PartNo)
    LEFT OUTER JOIN "Vendors.db" V
      ON (P.VendorNo = V.VendorNo)
    LEFT OUTER JOIN "Employee.db" E
      ON (O.EmpNo = E.EmpNo)

\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\
Steve Koterski                    "If you aren't fired with
Technical Publications            enthusiasm, you will be
Borland                           fired with enthusiasm."
                              -- Vince Lombardi (1913-1970)

Other Threads