Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL join with empty data in one table
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00392660
Message ID:
00392696
Vues:
8
Yes, that's what I'm looking for.
I will work tomorrow on it... :-))

>The simplest query would be SELECT yourfields FROM company LEFT JOIN sales ON ... WHERE price > 0 (just as you have it now) UNION SELECT yourfields FROM company WHERE company.id NOT IN (SELECT foreignkey FROM sales)
>
>However, NOT IN is not Rushmore optimizable. It might go faster if you break it into two queries: do your LEFT JOIN and leave out the WHERE condition, INTO CURSOR cursor1. Then SELECT * FROM cursor1 WHERE price > 0 UNION SELECT * FROM cursor1 WHERE ISNULL(price) or something like that. ISNULL() is optimizable.
Christian Isberner
Software Consultant
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform