Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
> Thanks for your reply. What's the difference in speed between ANSI-style BTW, this is a new term for me) and (?) Normal-style? I noticed, that right join takes lot of time in 'Normal' style.
Nadya,
There is no pre-ANSI outer joins in Fox, but they are still in T-SQL.
That's where I first faced this problem.
When I converted "old" syntax:
SELECT t1.Id,t2.f1 FROM t1,t2 WHERE t1.ID *= t2.KEY AND t2.f2 ="myValue"
to "new" syntax:
SELECT t1.Id,t2.f1 FROM t1 LEFT OUTER JOIN t2 ON t1.ID = t2.KEY WHERE t2.f2 ="myValue"
results were different exactly for same reason your query returned 0 rows.
My real query was not so simple (8 tables, 3 outer joins) and it took me awhile
to find out that in ANSI-92 WHERE restricts result set AFTER join has been performed, but in "old" style WHERE applied BEFORE the join!
So right conversion should be:
SELECT t1.Id,t2.field2 FROM t1 LEFT OUTER JOIN t2 ON t1.ID = t2.KEY
AND t2.f2 ="myValue"
In Fox "old" style exists only for INNER joins, but the rule still apply.
> Another question - is where a way to select only one field from Towns in this syntax? Like Towns.Town as TownName?
Yes, in this sense no difference. You can select fields you want and name them as you wish.
HTH
Oleg
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement