Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Optimize this SQL
Message
 
 
À
27/02/2007 17:13:39
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01199356
Message ID:
01199363
Vues:
12
It would create 2 lines if one of the columns in GROUP BY is different for n_terceiro=1 and n_terceiro=2.

>With this SQL statement i can SUM all qtCli and all qtFor for all cod_art, but it creates two lines one for QtCli and other for QtFor, any chance to join them in only one line
>
>
>	select c_codigo as c_cod_ter, cNomFor,c_cod_art,c_desc_art,
>		c_grupos,n_stk_real,
>		SUM(CASE n_terceiro WHEN 1 THEN n_quant ELSE 0 END) as QtCli,
>		SUM(CASE n_terceiro WHEN 2 THEN n_quant ELSE 0 END) as QtFor
>	from  #mov_enc_plano
>	group by c_codigo,c_cod_art, cNomFor,c_desc_art,c_grupos,n_stk_real
>	order by c_cod_art
>
>
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform