Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select doesn't produce expected results
Message
 
À
25/10/2012 12:12:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01555800
Message ID:
01555802
Vues:
51
In the first select you are left joining q3 and info, and in the second you are right joining q3 and info. Unless this is a one to one relationship, you expect the results to be different.The join conditions as stated are identical.

Not sure how useful this would be but you might want to swap the two tables. In that case you would probably get the same result, but what the use is of this exercise is somewhat questionable to me.

>Can someone help me understand this please? Below are 2 select statement that I expect would produce equal results but they do not. The only difference in the statements is the order of the join but one produces 30K records and the other 23K. The left join is also much faster that the right join. So what's going on here? My understanding is that the left join preserves all the records from the table on the left side and the right join preserves all the records on the right side. Since the left table in the first query is the same as the right table in the second, I would expect the results to be the same but they are not. So where am I wrong?
>
>
>
>SELECT pagcleanad as infoaddress,pagbusines as infobusiness, INT((mon1_empl+mon2_empl+mon3_empl)/3) as infoemploy, ;
>emp as q3Employ, address as q3address, trade_name as q3business ;
>FROM q3 ;
>left JOIN info ON address=pagcleanad AND trade_name=pagbusines
>
>SELECT pagcleanad as infoaddress,pagbusines as infobusiness, INT((mon1_empl+mon2_empl+mon3_empl)/3) as infoemploy, ;
>emp as q3Employ, address as q3address, trade_name as q3business ;
>FROM q3 ;
>right JOIN info ON pagcleanad=address AND pagbusines=trade_name
>
>
>Thanks

If things have the tendency to go your way, do not worry. It won't last. Jules Renard.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform