Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Optimize this SQL
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01199356
Message ID:
01199372
Vues:
16
>>>Hi Borislav,
>>>
>>>Hi know there are something diferent, n_terceiro like Sergey observe, but for display purpose i need only one row, like,
>>>
>>>
>>>the query gives (SQL Server)
>>> c_cod_art .... qtCli ... qtFor
>>>----------------------------------
>>>   AAAA           10        0
>>>   AAAA            0        5
>>>
>>>i need,
>>>
>>>   AAAA           10        5
>>>
>>>
>>>or another query based on first, to give only one row,
>>>
>>>João Batista
>>
>>Then don't include other columns in the query.Group only for c_cod_art and add SUM() columns, exclude all others from the query.
>
>
>select c_cod_art
>       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_cod_art
>order by c_cod_art
>
O GOD! I started talking to myself :-)
I just want to edit my post :-)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform