Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SELECT with CASE
Message
From
21/02/2005 18:56:09
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00989053
Message ID:
00989072
Views:
18
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform