Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Which SQL Select would be faster?
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01095983
Message ID:
01095993
Vues:
12
The first one is invalid so the second one wins.
You should always run tests to see which one is faster in your circumstances.

>I need to select records from a Parent Table filtering on fields
>in the Child Table. But I only need to select (show) fields from the Parent table.
>
>I am deciding which approach would be faster:
>
>
>*-- Approach 1. Selecting records from both tables with JOIN and
>*-- then grouping them
>select MAX(PARENT.FLD1), MAX(PARENT.FLD2) from PARENT
>  left join CHILD where (&cChildFilter) GROUP BY PARENT.PK_FLD
>
>
>vs
>
>
>*-- Approach 2. Selecting record from Parent table with subquery
>*-- from Child table.
>select P.* FROM PARENT P WHERE EXIST (SELECT * FROM CHILD C WHERE
>(&cChildFilter) AND C.PK_FLD = P.PK_FLD)
>
>
>I would appreciate any suggestions/input.
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform