Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SELECT with CASE
Message
De
21/02/2005 18:56:09
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00989053
Message ID:
00989072
Vues:
17
Sorry Sergey, i remove some clause (my mistake), the full one,
SELECT distinct  c_cod_art, c.c_descri, d.n_ent_sai, b.c_nome,
  c.n_ult_preco, c.n_ult_preco_liq, c.n_pcm,
  SUM (CASE WHEN d.n_ent_sai =  1 THEN n_quant_1 ELSE 0 END)  as ENT,	
  SUM (CASE WHEN d.n_ent_sai =  2 THEN n_quant_1 ELSE 0 END)  as SAI 	
  FROM tbl_gc_movimentosstk a 
  LEFT outer join tbl_gc_Artigos c on c.c_codigo=a.c_cod_art
  LEFT join tbl_gc_codMovimentosStk d on d.c_codigo=a.c_cod_mov
  GROUP BY c_cod_art, c.c_descri, d.n_ent_sai, b.c_nome, c.n_ult_preco,
  c.n_ult_preco_liq, c.n_pcm
  ORDER BY c_cod_art,d.n_ent_sai
João Batista
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform