Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL syntax question
Message
From
04/08/2003 18:35:40
 
 
To
04/08/2003 18:25:48
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00816671
Message ID:
00816676
Views:
18
Hi Randy

>How (in Fox sql) do I select ALL of the records in the parent table, whether (or not) they have a record in the child table?
>
>IOW: I want to report all of my customers and list their invoices (if they have any)

You need an OUTER JOIN for this.
SELECT * ;
  FROM customer LEFT OUTER JOIN invoices ;
    ON customer.customer_id = invoice.customer_id
 WHERE [add condition if needed]
This will give all rows from the LEFT table (customer) plus any matches from the RIGHT table (invoices). Note that non-matching records return NULL in the fields from the right table...!
----
Regards
Andy Kramek
Previous
Reply
Map
View

Click here to load this message in the networking platform