Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select problem
Message
From
16/05/2007 14:21:48
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
16/05/2007 14:17:22
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
01226113
Message ID:
01226115
Views:
26
>Given the following code sequence
>
>lnYear = 2005
>lcRawData = fileloc + 'surveys\RawData' + transform(lnYear)
>lcCompanyInfo = fileloc + 'surveys\companyinfo'
>
>select * ;
>	from (lcRawData) rd, ;
>	(lcCompanyInfo) ci ;
>	where rd.permid = ci.permid and ci.yearproduced = lnYear
>
>
>The RawData table contains 98274 records. If the WHERE clause of the select creates an inner join (does it not?) how can the result set contain 98511 records?

Yes, I understand it creates an inner join.

An inner join can produce more records than exist in any of the individual tables, if there are duplicates in the key values.

For example: TableA has 100 records with an empty key, whilst TableB has 200 records with an empty key (with "key" I mean the join field). As a result, VFP will do a Cartesian product between those records, and include 20000 records where you would expect no more than 100 or 200.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform