Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using self-join to merge rows into same column
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:
01239953
Message ID:
01240356
Vues:
17
Hi Marcel,

The WHERE clause filters out cars w/o both make and model. The NVL() is necessary if you don't want to see NULLs in the result in case when one of them (make or color) is not present in the cars table.
For optimization info see Using Rushmore Query Optimization to Speed Data Access in the help

>
>That helps me get a clearer picture. I made a slight alteration because the where clause seems to handle the same thing as NVL(). When you say it is not optimizable do you mean just using the EMPTY() function? Is there information somewhere on optimizable and non-optimizable functions? I changed it to look as follows:
>
>
>SELECT vehicles.order_key, lm.lup_value as make, lc.lup_value as color ;
>	FROM vehicles ;
>	LEFT JOIN lookup lm ;	
>		ON lm.lup_id = vehicles.make_key ;
>	LEFT JOIN lookup lc ;	
>		ON lc.lup_id = vehicles.color_key ;
>	WHERE vehicles.make_key <> 0 OR vehicles.color_key <> 0
>
>
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform