Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sql and where clauses
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00236881
Message ID:
00236970
Views:
14
I'm going to take a shot at this.


>> What we wanted is to obtain a resultset which contained all id's from table1 that had the property yy.lproperty, leaving out the records for which lproperty was .F.

This query could be written using a nested query instead of an INNER JOIN:

SELECT xx.id
FROM table1 xx
WHERE xx.id IN
(SELECT yy.id FROM table2 yy WHERE yy.lproperty = .T.)


>> What we got is all ids from table1 with .NULL. for yy.id and yy.lproperty from table2 for the records that had lproperty = .F.

I believe that what you're seeing is correct. As James replied, The LEFT JOIN will include all rows from the table on the left, whether or not they can be matched to the table on the right. If you have a row that can't be matched, VFP has to place something into any column coming from the table on the right. The SQL standard calls for a NULL to be placed. What you're seeing is a NULL being placed into yy.id and yy.lproperty by the LEFT JOIN operator.

-Mike
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Previous
Reply
Map
View

Click here to load this message in the networking platform