Tristan Leask <> wrote:
> Hi Guys,
>
> It's a Monday morning and my brain isn't working properly (surprise,
> surprise!)
>
> Anyway, I have 3 tables that I want to join together.
>
> Table 1 has 1 record =
>
> "Table1 My data"
>
> Table 2 has 1 record =
>
> "Table2 My data"
>
> Table 3 has 2 records =
>
> "Table3 My data record 1"
> "Table3 My data record 2"
>
> The output I want to get is to have 2 records of data that looks like
> the following...
>
> "Table1 My data", "Table2 My data", "Table3 My data record 1"
> "Table1 My data", .NULL., "Table3 My data record 2"
>
> Is this even possible with one SQL statement? Or would it just be
> easier to split it into two?
>
> SELECT table1.f1, table2.f1, table3.f1 FROM table1 INNER JOIN table2
> INNER JOIN table3 ON <join> ON <join> WHERE <statement> INTO CURSOR
> myCursor
>
> Comes back with...
>
> "Table1 My data", "Table2 My data", "Table3 My data record 1"
> "Table1 My data", "Table2 My data", "Table3 My data record 2"
No problem.
SELECT table1.f1, table2.f1, table3.f1 FROM table1
LEFT JOIN table2 ON <join>
left JOIN table3 ON <join>
WHERE <statement> INTO CURSOR myCursor
Don't use the "inner". Allow nulls with "outer" or " " type of left or
right joins.
HTH
Stephen Russell
DBA / .Net Developer
Memphis TN 38115
901.246-0159
"A good way to judge people is by observing how they treat those who
can do them absolutely no good." ---Unknown
http://spaces.msn.com/members/srussell/
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.18/733 - Release Date: 3/25/2007
11:07 AM
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.