Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Optimize this SQL
Message
From
27/02/2007 17:13:39
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Optimize this SQL
Miscellaneous
Thread ID:
01199356
Message ID:
01199356
Views:
77
Hi all

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
Thank's

João Batista
Next
Reply
Map
View

Click here to load this message in the networking platform